Cause (If you want to go to the method, skip this part):
I have one project that I have to add product to an e-commerce website and client sent me product images in PSD file and I need to convert it into JPG or PNG file to upload to the site. So the problem is, I don’t have Photoshop and (if I have) I don’t know how to use it. Hence, I find this solution, use ImageMagick to convert, resize, and center all images with ImageMagick instead of buying Photoshop to do it (or using GIMP).
If what you want to do is same as mine, PSD file, PSD has layer, mostly you want to convert it at the first layer. But if you want to know how many layer in PSD file you can use command “identify” to check it out,
The result will look like this,
Now you will see size, type, and other detail of its.
And how to get to each layer of its file is, [number] for example, image.psd, or image.psd
Next step is, get to the point “convert, resize, and center image”
You can use the command below to get what you want,
Note: -extend value must larger than source image size that you get from
See the result and source file below,
You can see image’s aspect at the source file and what ImageMagick does. It’s awesome that you can done this job with single line of command in your Terminal/Command-line tool.