We have an installation of magento that includes significant integration with imagemagick to resize images.
A previous developer developed an option that allows users to crop in proportionate rectangles - as per the attached screenshot. Users can move the crop lines around - and also pull it out (but it resizes as a proportionate rectangle)
http://imgur.com/zpUKpQl
We have a new developer and are trying to develop the codebase so users can individually drag in crop lines (and not have the overall crop resized proportionately)
Just wondering if anybody knows what this function is called within imagemagick. The developer is happy to work out the specifics - but wasn't sure where to start
Cheers
Dylan
Individually resizable crop lines
-
- Posts: 3
- Joined: 2016-06-07T02:39:42-07:00
- Authentication code: 1151
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Individually resizable crop lines
The ImageMagick crop command-line option is "-crop WxH+X+Y". See http://www.imagemagick.org/script/comma ... s.php#crop
If you mean "function" as in C-programming, it is CropImage() in transform.c
If you mean "function" as in C-programming, it is CropImage() in transform.c
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Individually resizable crop lines
See -crop at http://www.imagemagick.org/Usage/crop/#crop. You have to draw your box to some arbitrary size, then get the top left x,y and the width and height of your box. Then you would feed those to -crop WxH+X+Y +resize. Then you would feed that to -repage. But -resize will try to resize proportionally and so if the aspect of the box is not the same as that of the original image, then the resize will not end up the size you specified unless you either distort it (using !) or crop it further by making it bigger (using ^) or pad it. See
http://www.imagemagick.org/script/comma ... php#resize
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/Usage/thumbnails/#pad
http://www.imagemagick.org/Usage/thumbnails/#cut
http://www.imagemagick.org/script/comma ... php#resize
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/Usage/thumbnails/#pad
http://www.imagemagick.org/Usage/thumbnails/#cut
-
- Posts: 3
- Joined: 2016-06-07T02:39:42-07:00
- Authentication code: 1151
Re: Individually resizable crop lines
Thanks guys - that is some great points to get him started.
Regards
Dylan
Regards
Dylan
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Individually resizable crop lines
Another way of crop + resize together is with "-distort SRT" at the command line, or the functions in distort.c. However, for a real-time follow-the-mouse resize, ScaleImage() etc are probably faster. (You could do quick-and-dirty resizing while the user is holding down the mouse button, then slower but proper resize when the mouse button is released.)
snibgo's IM pages: im.snibgo.com