Page 1 of 1

Reduce canvas size non-destructively

Posted: 2020-03-26T12:13:09-07:00
by Bird
I need to be able to reduce the canvas size of a psd without losing the out-of-bounds layer information.

Like this:
Image

magick in.png -resize 500x -gravity center -extent 500x500 out.psd
doesn't work.

What am I doing wrong?

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T12:19:20-07:00
by fmw42
Your question is not clear. I do not understand exactly what you want. Post the original image without the guide lines that has layer information. Then show the result you want. Is the layer information the virtual canvas information that you need?

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T12:37:01-07:00
by Bird
This is the original image. The image size equals the canvas size.
Image

Using -extent sets the canvas size properly, but any layer information out-of-bounds is erased.
Image

I want to be able to reduce the canvas size without cropping the layer size. Yellow dashed line is the layer boundary.
Image

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T13:14:21-07:00
by fmw42
Your input in you command is a PNG. It does not have layer information. Did you mean PSD?

ImageMagick is limited in what it can do with PSD files.

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T13:26:24-07:00
by Bird
Thanks. No, the PNG was intentional there. Ideally, I want to input a PNG.

I also tried:

magick in.png -resize 500x out.psd
magick out.psd -gravity center -extent 500x500 out2.psd

and the same for tiff and xcf outputs.

I just want to be able to produce a file where the image information is larger than the canvas size. It seems not possible with IM.

-crop works but the center command is not honored and I also have to merge layers every time I open the output file since crop splits the image into separate layers.
magick in.png -resize 500x out.psd
magick out.psd -gravity center -crop 500x500 out2.psd

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T13:36:38-07:00
by Bird
Maybe ImageMagick has a different definition of "canvas size" than Photoshop or GIMP.

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T14:08:44-07:00
by snibgo
Bird wrote:I just want to be able to produce a file where the image information is larger than the canvas size. It seems not possible with IM.
In ImageMagick terms, that is easy:

Code: Select all

magick toes.png -page 30x40+10+20 x.png

magick x.png info:
x.png PNG 267x233 30x40+10+20 16-bit sRGB 320296B 0.031u 0:00.035
x.png has a 267x233 image on a 30x40 canvas. The image is entirely there; the canvas size is just metadata.

I don't know if this does what you want in a psd file.

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T14:33:58-07:00
by Bird
Sadly, the offset has an effect, but not the page size.

This is the manual operation I'm trying to reproduce:
Image

Re: Reduce canvas size non-destructively

Posted: 2020-03-26T14:51:40-07:00
by snibgo
PNG files have metadata for canvas size. IM reads and writes these. Gimp ignores them when reading, and won't write to them.