Code: Select all
imagemagick api
1. I have image test.jpg of 5177 x 3451 dimention,aspect ratio 3/2 and having size 51.2mb.
2. In my html page inside div I am setting image width to 1000px so becomes height 667px according to aspect ratio.
3.I am using cropzoom plugin to crop suppose i give crop of 615 x 410 px and x=90 y = 79
4 . So i am executing comman becomes...
Code: Select all
convert D:\CropZoom\pictures\test.jpg -crop 615.0x410.0+98.0+79.0 -strip -quality 100 D:\CropZoom\pictures\output.jpg
Update : Here is all command and my logic.....
Code: Select all
// resize image to original size...
convert D:\CropZoom\pictures\test.jpg -resize 5177.0 x 3451.0 -quality 100 D:\CropZoom\pictures\output.jpg
rotate image if rotation slider value not == 0
convert D:\CropZoom\pictures\output.jpg -background transparent -rotate 0.0 -quality 100 D:\CropZoom\pictures\output.jpg
//This fix the page of the image so it crops fine!
convert D:\CropZoom\pictures\output.jpg -repage 0x0+0+0 -quality 100 D:\CropZoom\pictures\output.jpg
//crop the image with the viewed into the viewport .i.e crop container div(1000 x 600)
convert D:\CropZoom\pictures\output.jpg -crop 1000.0x600.0+0.0+0.0 -quality 100 D:\CropZoom\pictures\output.jpg
//create the viewport to put the cropped image
convert -size 1000.0x600.0 xc:black -quality 100 D:\CropZoom\pictures\viewport.jpg
//crop image according selector width,height,pageX,pageY
convert D:\CropZoom\pictures\output.jpg -crop 615.0x410.0+98.0+79.0 -quality 100 D:\CropZoom\pictures\cropped.jpg