bufferedimage


Jcrop not cropping properly the images

落爺英雄遲暮 提交于 2020-02-20 07:55:06
问题 My jcrop code $(function(){ // Create variables (in this scope) to hold the API and image size var jcrop_api, boundx, boundy, // Grab some information about the preview pane $preview = $('#preview-pane'), $pcnt = $('#preview-pane .preview-container'), $pimg = $('#preview-pane .preview-container img'), xsize = $pcnt.width(), ysize = $pcnt.height(); //console.log('init',[xsize,ysize]); $('#target').Jcrop({ onChange: updateInfo, onSelect: updateInfo, onRelease: clearInfo, setSelect: [0, 0, 150,

Resizing TYPE_CUSTOM BufferedImages?

偶尔善良 提交于 2020-01-24 08:48:00
问题 When I read a JPEG from disk, Java sometimes gives me a BufferedImage whose getType() returns TYPE_CUSTOM -- that is, it has a custom color model. I'd like to resize this BufferedImage but I'm not sure how to construct the destination object. Can someone please provide sample code for using the following constructor? BufferedImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable properties) I would like to create a BufferedImage of the same type as the source,

Resizing TYPE_CUSTOM BufferedImages?

守給你的承諾、 提交于 2020-01-24 08:46:48
问题 When I read a JPEG from disk, Java sometimes gives me a BufferedImage whose getType() returns TYPE_CUSTOM -- that is, it has a custom color model. I'd like to resize this BufferedImage but I'm not sure how to construct the destination object. Can someone please provide sample code for using the following constructor? BufferedImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, Hashtable properties) I would like to create a BufferedImage of the same type as the source,

Getting filename from BufferedImage

扶醉桌前 提交于 2020-01-24 05:21:24
问题 Is there a way to get the filename from a BufferedImage? I don't seem to see any methods for it. 回答1: A BufferedImage doesn't necessarily have to be backed by a file. It could be a byte array in a database, or even backed by a stream. 回答2: A BufferedImage is not necessarily associated with a file. Just as you can read a String from a file, but there is no getFilename() method on String objects, there is no such method on BufferedImage . 来源: https://stackoverflow.com/questions/4611303/getting

Reliable way to check if image is Grey scale

為{幸葍}努か 提交于 2020-01-24 04:27:07
问题 I am currently working on one use case where i need to determine if uploaded image is Grey Scale or RGB. I found couple of ways to identify this, but not sure if they are reliable and can be used collectively to confirm image is grey scale or not. Part 1: Read Image and get NumberDataElements using Raster. BufferedImage image = ImageIO.read(file); Raster ras = image.getRaster(); int elem = ras.getNumDataElements(); I observed value of elem is "1" in some cases, but not in all. Part 2: Check

Clipboard copy from outlook always has black background set when retrieved as image from Java clipboard object

假如想象 提交于 2020-01-21 10:06:28
问题 Here are the application steps copy some richtext from a html email message or from a website(a combination of text + image) In your java code retrieve the content copied from the clipboard object as BufferredImage Save the retrieved image object as image file on disk You'll notice that in the saved file, the image comes fine, any non-black text appears fine but black text seems lost in the black background. Could not find a way to override the black background for the generated image. Some

Clipboard copy from outlook always has black background set when retrieved as image from Java clipboard object

只谈情不闲聊 提交于 2020-01-21 10:05:13
问题 Here are the application steps copy some richtext from a html email message or from a website(a combination of text + image) In your java code retrieve the content copied from the clipboard object as BufferredImage Save the retrieved image object as image file on disk You'll notice that in the saved file, the image comes fine, any non-black text appears fine but black text seems lost in the black background. Could not find a way to override the black background for the generated image. Some

Impact of TYPE_INT_ARGB_PRE

丶灬走出姿态 提交于 2020-01-17 09:11:08
问题 I've been having some issues with a ConvolveOp that can be fixed by setting the imageType of the BufferedImage I'm working with to TYPE_INT_ARGB_PRE (see related SO answer here). Unfortunately I don't fully understand all the implications of selecting this different imageType and I can't seem to find a good reference either, so let me try here: Which drawing operations are affected by changing the imageType of a BufferedImage from TYPE_INT_ARGB to TYPE_INT_ARGB_PRE? Is it just

Drawing an image on top of an image in a JComponent erases part of the bottom image

狂风中的少年 提交于 2020-01-17 05:38:41
问题 I am making a 2d game and I need to draw an image on top of another. After I draw the first image(the larger one, jpg), the second image(the smaller one,png) erases from where the second image is to the lower right hand corner. Like this: I have looked into this a bit, and it was suggested that I use buffered images, so I did that with both images and the problem remains. Here is one post I looked at: How to draw an image over another image?. I have also seen some people suggesting graphics2d

Java transforming BufferedImage “Subimage” defined by 4 Points [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-17 05:08:55
问题 This question already has an answer here : How to get sub image from buffered image (1 answer) Closed 3 years ago . I've been doing some work on my school project and came to the point where i need help again :) I've been researching about transforming images in Java, but i haven't really found any useful information in terms of that. I have found this article but since I don't know much python i wasn't able to get what they are doing. I'd like to do pretty much the same thing, but in Java.

工具导航Map