Page 1 of 1

Canvas and offset

Posted: 2012-05-30T15:30:30-07:00
by VanGog
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?

Re: Canvas and offset

Posted: 2012-05-30T18:11:16-07:00
by fmw42
convert -size -size 17552x11128 -xc:none
I think you mean

Code: Select all

    convert -size 17552x11128 xc:none newimage.xxx 
I don't think you can set a virtual-canvas for a constant color image when creating it. You can use -page or -repage when using the image.
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.
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?
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.

see
http://www.imagemagick.org/script/comma ... hp#comment

IM does not support GEOTIFF tags to my knowledge

Re: Canvas and offset

Posted: 2012-05-30T18:49:28-07:00
by anthony
You can set the virtual canvas for a new image using -page

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
You can even do it AFTER creating...

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
With a solid color image you can set teh size afetr creating a single pixel image too (though that has a processing expense)

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
Whcih brings us to using a resize read modifier

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
The page can also be set using crop (again more processing - though less so than resize)
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
ASIDE. the above assumes the -virtual-pixel default of 'Edge' and could be sped up by setting -filter point (using the default bilinear interpolation)

Re: Canvas and offset

Posted: 2012-05-30T18:56:22-07:00
by fmw42
anthony wrote:You can set the virtual canvas for a new image using -page

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
You can even do it AFTER creating...

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
Thanks Anthony. That is very helpful. I never thought about doing especially the former.

Re: Canvas and offset

Posted: 2012-05-30T18:58:11-07:00
by anthony
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?
Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.

For example...

Code: Select all

   convert rose: -set my_info:name 'A Rose'  rose.png
   identify -format '%[my_info:name]' rose.png
   A Rose
The 'my_info:' part in the above is purely to ensure your 'property' does not clash with other settings, such as EXIF: or Date:
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.

Re: Canvas and offset

Posted: 2012-05-30T20:07:11-07:00
by fmw42
Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.
Another very useful tidbit! Thanks.

Re: Canvas and offset

Posted: 2012-05-30T20:08:51-07:00
by anthony
fmw42 wrote:
Any information that is saved as a image properity Using -set. Will be saved in image file formats PNG and MIFF.
Another very useful tidbit! Thanks.
And noted in IM Examples a long time ago, though it was more of an aside comment about these formats..
Montage, Using Saved MetaData
http://www.imagemagick.org/Usage/montage/#metadata

Re: Canvas and offset

Posted: 2012-05-30T23:50:45-07:00
by VanGog
anthony wrote:

Code: Select all

   convert rose: -set my_info:name 'A Rose'  rose.png
   identify -format '%[my_info:name]' rose.png
   A Rose
Thank you. On Windows I must change the quotes to "".

Code: Select all

convert rose: -set my_name:name "A Rose"  rose.png
identify -format '%%[my_name:name]' rose.png
It works :-)

Re: Canvas and offset

Posted: 2012-05-31T00:39:55-07:00
by VanGog
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
What does mean the 16-bit DirectClass?

Re: Canvas and offset

Posted: 2012-05-31T21:29:02-07:00
by anthony
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.

Re: Canvas and offset

Posted: 2012-06-01T01:21:07-07:00
by VanGog
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.
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).

Re: Canvas and offset

Posted: 2012-06-02T20:11:01-07:00
by anthony

Re: Canvas and offset

Posted: 2012-06-03T09:57:52-07:00
by VanGog
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.