Canvas and offset
Canvas and offset
If I would use
convert -size -size 17552x11128 -xc:none
to create canvas, should I definate some offset?
My working area is 17480,11032 (x,y).
Otherwise I could draw pixels into the working area and then use crop. But that's not clear to me, if is it the same or not. Should the offset be defined first if I want to know the offset?
viewtopic.php?f=1&t=20663#p82848
Yet one more idea. How to save information into the image (BW. png), if possible? Can I save there geological coordinates, and some other values? And later to extract them?
convert -size -size 17552x11128 -xc:none
to create canvas, should I definate some offset?
My working area is 17480,11032 (x,y).
Otherwise I could draw pixels into the working area and then use crop. But that's not clear to me, if is it the same or not. Should the offset be defined first if I want to know the offset?
viewtopic.php?f=1&t=20663#p82848
Yet one more idea. How to save information into the image (BW. png), if possible? Can I save there geological coordinates, and some other values? And later to extract them?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Canvas and offset
I think you meanconvert -size -size 17552x11128 -xc:none
Code: Select all
convert -size 17552x11128 xc:none newimage.xxx
see
http://www.imagemagick.org/Usage/basics/#page
or use -define distort:viewport=WxH+X+Y when using it with -distort SRT
see
http://www.imagemagick.org/Usage/distor ... t_viewport
However, I will defer to Anthony, who knows more about virtual canvas usage than I.
The only way I know is through the use of -comment or -set comment. That will put your information in the verbose information from which you can extract it later.How to save information into the image (BW. png), if possible? Can I save there geological coordinates, and some other values? And later to extract them?
see
http://www.imagemagick.org/script/comma ... hp#comment
IM does not support GEOTIFF tags to my knowledge
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Canvas and offset
You can set the virtual canvas for a new image using -page
You can even do it AFTER creating...
With a solid color image you can set teh size afetr creating a single pixel image too (though that has a processing expense)
Whcih brings us to using a resize read modifier
The page can also be set using crop (again more processing - though less so than resize)
NOTE the arrangements of the real/virtual sizes!
As Fred pointed out distort can also do this... But that is getting into very heavy extra processing for very little reward.
And it does not set the actual canavs size to something that use 'useful)
ASIDE. the above assumes the -virtual-pixel default of 'Edge' and could be sped up by setting -filter point (using the default bilinear interpolation)
Code: Select all
convert -size 100x100 -page 200x200+50+50 xc:none info:
xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.019
Code: Select all
convert -size 100x100 xc:none -repage 200x200+50+50 info:
xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.000
Code: Select all
convert xc:none -resize 100x100 -repage 200x200+50+50 info:
xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.000
Code: Select all
convert xc:none'[100x100]' -repage 200x200+50+50 info:
xc:none[100x100] XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.000
NOTE the arrangements of the real/virtual sizes!
Code: Select all
convert xc:none'[200x200]' -crop 100x100+50+50 info:
xc:none[200x200] XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.000
As Fred pointed out distort can also do this... But that is getting into very heavy extra processing for very little reward.
And it does not set the actual canavs size to something that use 'useful)
Code: Select all
convert xc:none -define distort:viewport=100x100+50+50 -distort SRT 0 info:
xc:none XC 100x100 100x100+50+50 16-bit DirectClass 0.000u 0:00.000
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Canvas and offset
Thanks Anthony. That is very helpful. I never thought about doing especially the former.anthony wrote:You can set the virtual canvas for a new image using -pageYou can even do it AFTER creating...Code: Select all
convert -size 100x100 -page 200x200+50+50 xc:none info: xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.019
Code: Select all
convert -size 100x100 xc:none -repage 200x200+50+50 info: xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.000
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Canvas and offset
Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.How to save information into the image (BW. png), if possible? Can I save there geological coordinates, and some other values? And later to extract them?
For example...
Code: Select all
convert rose: -set my_info:name 'A Rose' rose.png
identify -format '%[my_info:name]' rose.png
A Rose
It is not actually necessary, but recommended.
More information about the three types of settings... per-image 'property', per-image 'artefact', global 'option'... (the latter two are very closely linked) will be documented as part of the re-development of IMv7 Command line, which will make more use of such settings as percent escapes than IMv6 does.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Canvas and offset
Another very useful tidbit! Thanks.Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Canvas and offset
And noted in IM Examples a long time ago, though it was more of an aside comment about these formats..fmw42 wrote:Another very useful tidbit! Thanks.Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.
Montage, Using Saved MetaData
http://www.imagemagick.org/Usage/montage/#metadata
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Canvas and offset
Thank you. On Windows I must change the quotes to "".anthony wrote:Code: Select all
convert rose: -set my_info:name 'A Rose' rose.png identify -format '%[my_info:name]' rose.png A Rose
Code: Select all
convert rose: -set my_name:name "A Rose" rose.png
identify -format '%%[my_name:name]' rose.png
Re: Canvas and offset
What does mean the 16-bit DirectClass?fmw42 wrote:anthony wrote:Code: Select all
convert -size 100x100 -page 200x200+50+50 xc:none info: xc:none XC 100x100 200x200+50+50 16-bit DirectClass 0.000u 0:00.019
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Canvas and offset
It means the image was saved at 16 bit depth (16 bits per color value), and Direct Color is individual RGB color values per pixel and not a index into a color table (PalletteColor) or even GrayScale.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Canvas and offset
Thank you for answer. I was worried of it. Can you tell me how to save the image as binary mask or as grayscale, but with a regard, that I would want to be able to read information from empty areas (as 0).anthony wrote:It means the image was saved at 16 bit depth (16 bits per color value), and Direct Color is individual RGB color values per pixel and not a index into a color table (PalletteColor) or even GrayScale.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Canvas and offset
See PNG format info
http://www.imagemagick.org/Usage/formats/#png
http://www.imagemagick.org/Usage/formats/#png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Canvas and offset
What is the difference if I define color type 3 as indexed color, how can I define bit depth?
-define png:color-type={type}
And what is it bit depth? Can I use three colors when I would have depth 4? What is size difference If I have mask 4096x4096 and there black (or empty) and white squares.
-define png:color-type={type}
And what is it bit depth? Can I use three colors when I would have depth 4? What is size difference If I have mask 4096x4096 and there black (or empty) and white squares.