Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/image.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorKaran Dwivedi <karan.dwivedi42@gmail.com>2016-10-11 01:45:13 +0300
committerKaran Dwivedi <karan.dwivedi42@gmail.com>2016-10-11 01:45:13 +0300
commit5f8889b7faf721171ca7bad7171097bbff8ee629 (patch)
treeda251ad33bfcd5df448404f778800a3a02e29a7f /doc
parentad5a376ca2044092d8945b5211da050f82f2fb74 (diff)
Add image.getSize(filename) function
Add getPPMsize and getPGMsize functions Combine them with getPNGsize and getJPGsize for getSize function
Diffstat (limited to 'doc')
-rw-r--r--doc/saveload.md32
1 files changed, 22 insertions, 10 deletions
diff --git a/doc/saveload.md b/doc/saveload.md
index d90fc20..b9fa1fd 100644
--- a/doc/saveload.md
+++ b/doc/saveload.md
@@ -1,23 +1,23 @@
<a name="image.saveload"></a>
## Saving and Loading ##
-This sections includes functions for saving and loading different types
+This sections includes functions for saving and loading different types
of images to and from disk.
<a name="image.load"></a>
### [res] image.load(filename, [depth, tensortype]) ###
Loads an image located at path `filename` having `depth` channels (1 or 3)
into a [Tensor](https://github.com/torch/torch7/blob/master/doc/tensor.md#tensor)
-of type `tensortype` (*float*, *double* or *byte*). The last two arguments
+of type `tensortype` (*float*, *double* or *byte*). The last two arguments
are optional.
-The image format is determined from the `filename`'s
-extension suffix. Supported formats are
-[JPEG](https://en.wikipedia.org/wiki/JPEG),
-[PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics),
+The image format is determined from the `filename`'s
+extension suffix. Supported formats are
+[JPEG](https://en.wikipedia.org/wiki/JPEG),
+[PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics),
[PPM and PGM](https://en.wikipedia.org/wiki/Netpbm_format).
-
-The returned `res` Tensor has size `nChannel x height x width` where `nChannel` is
-1 (greyscale) or 3 (usually [RGB](https://en.wikipedia.org/wiki/RGB_color_model)
+
+The returned `res` Tensor has size `nChannel x height x width` where `nChannel` is
+1 (greyscale) or 3 (usually [RGB](https://en.wikipedia.org/wiki/RGB_color_model)
or [YUV](https://en.wikipedia.org/wiki/YUV).
Usage:
@@ -30,9 +30,21 @@ local img = image.load(imagefile,1,'byte')
```
+<a name="image.getSize"></a>
+### [res] image.getSize(filename) ###
+Return the size of an image located at path `filename` into a LongTensor.
+
+The image format is determined from the `filename`'s
+extension suffix. Supported formats are
+[JPEG](https://en.wikipedia.org/wiki/JPEG),
+[PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics),
+[PPM and PGM](https://en.wikipedia.org/wiki/Netpbm_format).
+
+The returned `res` Tensor has size `3` (nChannel, height, width).
+
<a name="image.save"></a>
### image.save(filename, tensor) ###
-Saves Tensor `tensor` to disk at path `filename`. The format to which
+Saves Tensor `tensor` to disk at path `filename`. The format to which
the image is saved is extrapolated from the `filename`'s extension suffix.
The `tensor` should be of size `nChannel x height x width`.
To save with a minimal loss, the tensor values should lie in the range [0, 1] since the tensor is clamped between 0 and 1 before being saved to the disk.