Answer the question
In order to leave comments, you need to log in
How to crop an image in Graphics Magick?
The input formats are:
- jpeg (which, in general, do not need to be cut);
- png, some of which have a transparent background and need to be clipped, here's an example .
After processing, the images are saved in jpeg format with a black background and a fixed size (if the source was a transparent png).
The use of "-trim" does not give the desired result: png with transparency are cropped as it should, but images with a uniform background fall under the distribution, and often cut off huge pieces from the image.
I tried the "-border 1x1 -bordercolor transparent -trim" combo, partially solved the problem, but images containing an overwhelming amount of black (on the edges and in the center) are trimmed to 0x0, resulting in just a black image of the set size on the output. I understand that "-bordercolor transparent" does not give the desired effect and the border turns out to be black in reality, then trimming occurs in black - that's why we have a black image. Preset "-background transparent" didn't help.
How can I cut off only the transparent area of a png?
GraphicsMagick 1.3.12, NodeJS, I use this module, I set commands via gm.in().
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question