mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
26 lines
810 B
Markdown
26 lines
810 B
Markdown
---
|
|
nav-title: "image-source How-To"
|
|
title: "How-To"
|
|
description: "Examples for using image-source"
|
|
---
|
|
# Image source
|
|
Using the image source requires the image-source module.
|
|
<snippet id='imagesource-require'/>
|
|
The pre-required `imageSource` module is used throughout the following code snippets.
|
|
We also use fs module defined as follows:
|
|
<snippet id='imagesource-require-alt'/>
|
|
|
|
## Loading and saving images
|
|
### Load image using resource name
|
|
This is similar to loading Bitmap from `R.drawable.logo` on Android or calling `[UIImage imageNamed@"logo"]` on iOS
|
|
<snippet id='imagesource-resname'/>
|
|
|
|
### Load image from URL
|
|
<snippet id='imagesource-load-url'/>
|
|
|
|
### Save image source to PNG or JPG file
|
|
<snippet id='imagesource-save-to'/>
|
|
|
|
### Load image from a local file
|
|
<snippet id='imagesource-load-local'/>
|