Page 1 of 1

[SOLVED] Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T12:24:18-07:00
by magmical
Hello!

I've searched for a while and did find some hints but no explicit statement:

Are the following 3 commands absolutely equal?

Code: Select all

convert: +repage
convert: -repage 0x0
MSL: <repage geometry="0x0" />
Thanks.

Re: Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T12:33:00-07:00
by GreenKoopa
They are not the same.

--- EDIT ---

Sorry, that was less than a full answer.

+repage = removes the meta-data
-repage 0x0 = recalculates the canvas size, and keeps the current offsets

Re: Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T12:50:13-07:00
by magmical
Thanks again!
They are not the same.
Oh well, now I am a bit surprised. :)

I am quite sure that these are equal, isn't it:

Code: Select all

convert: -repage 0x0
MSL: <repage geometry="0x0" />
If so lets concentrate on these:

Code: Select all

+repage
-repage 0x0
Can you be more detailed whats the difference beween them?

--- EDIT ---

OK, I saw your edit after typing my post... sorry, too. :)

Re: Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T13:05:21-07:00
by magmical
+repage = removes the meta-data
-repage 0x0 = recalculates the canvas size, and keeps the current offsets
Thanks for this additonal info! Now it becomes clearer.

One final question:
If I do a crop with convert like "-crop "100x100+0+0" what's the correct repage after this?

When I guess right it must be -repage "0x0+0+0" to recalc the canvas size; especially when writing a GIF.
Would this be the correct way?

Re: Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T13:21:54-07:00
by GreenKoopa
I guess "correct" depends on your need. For me, I usually use +repage because I rarely want this meta-data. I think -repage 0x0+0+0 will give you the same result for all practical purposes, but there may exist some file format where this meta-data is optional. Still, the only difference I can imaging is a few extra bytes in your output file to explicitly write the zeros. In the case of your crop with zero offset, -repage 0x0 would probably be the same. Maybe some of all this would change if you were using -gravity.

Re: Is "+repage" and "-repage 0x0" exactly the same?

Posted: 2013-05-10T13:35:24-07:00
by magmical
Thank you very much for your help!

There is so much to learn about ImageMagick! :D

Re: [SOLVED] Is "+repage" and "-repage 0x0" exactly the same

Posted: 2013-05-10T14:10:34-07:00
by fmw42

Re: [SOLVED] Is "+repage" and "-repage 0x0" exactly the same

Posted: 2013-05-11T03:56:55-07:00
by magmical
fmw42 wrote:They are the same. see http://www.imagemagick.org/Usage/basics/#page
I found it on the page:

Code: Select all

-repage 0x0+0+0
    Equivalent to a "+repage" 
Now thats a proof. It should be definitely the same.

Thanks for this hint!

[CONCLUSION] Is "+repage" and "-repage 0x0" exactly the same

Posted: 2013-05-11T04:00:34-07:00
by magmical

Code: Select all

convert: +repage
convert: -repage 0x0
MSL: <repage geometry="0x0" />
Is NOT the same!
Difference: repage 0x0 keeps the current offsets!

But:

Code: Select all

convert: +repage
convert: -repage 0x0+0+0
MSL: <repage geometry="0x0+0+0" />
IS the same!

Re: [SOLVED] Is "+repage" and "-repage 0x0" exactly the same

Posted: 2013-05-12T19:02:59-07:00
by anthony
They (the original post) are NOT the same...

+repage zeros all virtual canvas and offset info.
-repage 0x0 only resets the canvas, offset is left as is
-repage +0+0 resets the offset but NOT virtual canvas info
-repage 0x0+0+0 resets all to zero (same as +repage)

When virtual canvas size is zero (nonsensical but the default setting) the images actual size is used instead.

I should know -- I programmed the operator!

The only thing missing from the above is '!' for relative offset changes.
I do not have a relative canvas size change, though I wish I had included it :-)

now...

-page is like -repage but only for images, yet to be read in.
That is you can use it to override canvas and/or offset of images as they are being read in.

It is called page because originally this was used for handling Postscript reading and writing (A4 pages with offsets)
though it was also being used for GIF animations. Its role expanded with the original development of IMv6.

Re: [SOLVED] Is "+repage" and "-repage 0x0" exactly the same

Posted: 2013-05-13T05:55:08-07:00
by magmical
There is nothing to add. :)

Thanks for your final descriptions.