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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-10T12:24:18-07:00

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.
Last edited by magmical on 2013-05-10T13:36:40-07:00, edited 1 time in total.

User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

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

Post by GreenKoopa » 2013-05-10T12:33:00-07:00

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

magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-10T12:50:13-07:00

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. :)

magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-10T13:05:21-07:00

+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?

User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

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

Post by GreenKoopa » 2013-05-10T13:21:54-07:00

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.

magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-10T13:35:24-07:00

Thank you very much for your help!

There is so much to learn about ImageMagick! :D

User avatar
fmw42
Posts: 25131
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2013-05-10T14:10:34-07:00


magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-11T03:56:55-07:00

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!

magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-11T04:00:34-07:00

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!

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post by anthony » 2013-05-12T19:02:59-07:00

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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

magmical
Posts: 30
Joined: 2013-05-03T05:31:05-07:00
Authentication code: 6789

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

Post by magmical » 2013-05-13T05:55:08-07:00

There is nothing to add. :)

Thanks for your final descriptions.

Post Reply