crop

How to crop image in java?

随声附和 提交于 2020-01-07 09:26:07
问题 I'm using java to crop image when upload file, I set value and to try to crop but is not get correct size of image as I expected This my code: ( updated ) private BufferedImage cropImageSquare(byte[] image) throws IOException { InputStream in = new ByteArrayInputStream(image); BufferedImage originalImage = ImageIO.read(in); System.out.println("Original Image Dimension: "+originalImage.getWidth()+"x"+originalImage.getHeight()); BufferedImage croppedImage = originalImage.getSubimage(300, 150,

How to crop image in java?

落花浮王杯 提交于 2020-01-07 09:26:05
问题 I'm using java to crop image when upload file, I set value and to try to crop but is not get correct size of image as I expected This my code: ( updated ) private BufferedImage cropImageSquare(byte[] image) throws IOException { InputStream in = new ByteArrayInputStream(image); BufferedImage originalImage = ImageIO.read(in); System.out.println("Original Image Dimension: "+originalImage.getWidth()+"x"+originalImage.getHeight()); BufferedImage croppedImage = originalImage.getSubimage(300, 150,

Image cropping with jquery

无人久伴 提交于 2020-01-06 20:15:59
问题 I'm looking to have users upload an image and then it will be cropped to a set size. What I'd like to have happen is essentially a div that's set to the specific crop size and the image inside that box. The user would then be able to slide the image around and whatever was visible in that div is what the image would be cropped to. All of the jquery plugins I've come across simply let the user move a selection box around the full image and not move the image behind the selection box. Does this

Crop image using php

坚强是说给别人听的谎言 提交于 2020-01-06 08:13:32
问题 I want to crop an image. Is it possible to do like this. And if yes, how would the crop() function look like? $imgURL is always a .jpg image. $image = file_get_contents($imgURL); $maxWidth = 100; $height = 68; $image = crop($image, $maxWidth, $height); file_put_contents("media/imgname.jpg", $image); function crop($image, $maxWidth, $height){ ...how do I crop the image? } 回答1: If you have the GD library installed, taked a look at the functions available to you. If you want more explanation and

Cropping whitespace from an Image

这一生的挚爱 提交于 2020-01-05 05:33:06
问题 Anyone know of a good method of cropping whitespace from an image? I have an external method which generates Image objects containing charts, but unfortunately they have lots of white space which I would like to remove. Thanks, Alex 回答1: Found a solution after googling for some different terms... Always happens... For reference: http://fitnessconnections.com/blog/remove-surrounding-white-space-from-an-image/ 来源: https://stackoverflow.com/questions/3767463/cropping-whitespace-from-an-image

android image preview example for cropping

强颜欢笑 提交于 2020-01-05 04:12:12
问题 Many apps, such as Facebook, have this feature where after a user chooses an image from their device's gallery, the user is then brought to a preview where they can choose a cropped version of their image. After looking through SO (e.g. How to crop image on camera preview "Goggles style" - Android), I found this link to a an example, but the zip seems to be for sale ( CameraPreview.zip ). Since that post is a bit old, I was wondering if someone is aware of another example out there or if they

error facing while cropping photo using Paperclip in Rails 3

孤人 提交于 2020-01-04 06:12:35
问题 Hi i am trying to crop photo using paperclip and imagemagick. I am facing some error while cropping photo. following is the error stack: ?[32mCommand?[0m :: convert "C:/Users/Anand/AppData/Local/Temp/120120924-3568-tx 2bxy.jpg[0]" -crop 103x103+0+0 -auto-orient "C:/Users/Anand/AppData/Local/Temp/1 20120924-3568-tx2bxy20120924-3568-16dij9c" ?[32mCommand?[0m :: file -b --mime "C:/Users/Anand/AppData/Local/Temp/120120924- 3568-tx2bxy20120924-3568-16dij9c" [paperclip] Error while determining

error facing while cropping photo using Paperclip in Rails 3

ぐ巨炮叔叔 提交于 2020-01-04 06:12:26
问题 Hi i am trying to crop photo using paperclip and imagemagick. I am facing some error while cropping photo. following is the error stack: ?[32mCommand?[0m :: convert "C:/Users/Anand/AppData/Local/Temp/120120924-3568-tx 2bxy.jpg[0]" -crop 103x103+0+0 -auto-orient "C:/Users/Anand/AppData/Local/Temp/1 20120924-3568-tx2bxy20120924-3568-16dij9c" ?[32mCommand?[0m :: file -b --mime "C:/Users/Anand/AppData/Local/Temp/120120924- 3568-tx2bxy20120924-3568-16dij9c" [paperclip] Error while determining

ngImgCrop Dependency Injection not working properly in AngularJs

廉价感情. 提交于 2020-01-04 05:16:10
问题 I am using ng-img-crop in angular . After installing it by "bower install --save ngImgCrop" and injecting the dependency when I run it by grunt command, I got an error: Uncaught Error: [$injector:modulerr] Failed to instantiate module mean due to: Error: [$injector:modulerr] Failed to instantiate module ngImgCrop due to: Error: [$injector:nomod] Module 'ngImgCrop' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the

Crop an Image in irregular shape

纵饮孤独 提交于 2020-01-03 16:59:33
问题 I need to crop an Image in irregular shape my app, i.e., I select a portion by finger and if I click crop button, the selected portion alone in the Image will be saved in SDCard. How to achieve it? 回答1: You have to define a Path for the Shape you want to be cut out. Then create a rectangle around it an set everything between your shape an the rectangle to transparent (Alpha Channel) This source here should give you some hints: https://github.com/lvillani/android-cropimage/blob/develop/src/com