bufferedimage

How to work with BufferedImage and YCbCr colorspace?

你离开我真会死。 提交于 2019-12-12 04:37:15
问题 I need to translate colors in bitmap loaded to BufferedImage from RGB to YCbCr (luminance and 2 channels chrominance) and back after process. I made it with functions used like rgb2ycbcr() in main method for each pixel, but it isn't so smart solution. I should use ColorSpace and ColorModel classes to get BufferedImage with correct color space. It would be more flexible method, but I don't know how to do that. I'm lost and I need some tips. Can somebody help me? 回答1: As I understood your

PDFBox draw black image from BufferedImage

怎甘沉沦 提交于 2019-12-12 02:06:03
问题 I try to draw an image from a bufferedImage into a PDF using PDFBox but fails, and I get black images and Acrobat Reader warns whith errors like "Out of memory" (but PDF is display). I use a bufferedImage because I need to draw a JavaFX Image object (with came from call to Funciones.crearImagenDesdeTexto(), is a function which converts a text into an Image) into PDF. Rest of images works well without using bufferedimage. PDPixelMap img = null; BufferedImage bi; try { //If item has id, I try

Convert raw pixel data (as byte array) to BufferedImage

耗尽温柔 提交于 2019-12-11 23:45:12
问题 I have a requirement to use a native library which reads some proprietary image file formats (something about not reinventing our own wheel). The library works fine, it's just sometimes the images can get pretty big (the record I've seen being 13k x 15k pixels). The problem is my poor JVM keeps dying a painful death and / or throwing OutOfMemoryError's any time the images start getting huge. Here's what I have running //the bands, width, and height fields are set in the native code //And the

Java screen capture App - How to?

巧了我就是萌 提交于 2019-12-11 22:32:21
问题 i am not a native english speaker so, firstly sorry for the grammar. I want to do an app that capture a selected area of a screen and save it. I did a few research and i did the code down below. My questions are: 1 - How can i open a pdf file in this app ? (i tried use a method but it didnt work. I dont know exactly where to put it on the code) 2 - How can i save the selected area in a new file ? (a image file : JPEG, JPG,png) 3 - [the complex part] right now, the code only "save" one

Is there a more efficient way to rotate images in Java than AffineTransform?

半腔热情 提交于 2019-12-11 20:13:55
问题 I've looked around for ways to rotate BufferedImage s in Java and all I have found is AffineTransform . That's fine, but it seems like a bit of overkill if all I want to do is rotate 90 degrees. Would it be more efficient to just do it pixel-by-pixel? Is there some other method I could use? 回答1: From the Javadoc of the class you mention: Handling 90-Degree Rotations In some variations of the rotate methods in the AffineTransform class, a double-precision argument specifies the angle of

ImageIO wont import BufferedImage correctly

允我心安 提交于 2019-12-11 18:08:51
问题 Error thrown-- Exception in thread "Thread-3" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) Code-- try { playerImage = ImageIO.read(Player.class .getResourceAsStream("/toon.png")); } catch (IOException e) { e.printStackTrace(); } File path-- H:\workspace\Isaac\resources\toon.png Ive researched this a bit but none of the solutions have really worked for me. any ideas? 回答1: If Isaac is your project folder, then the way your are reading should

How to Change ImageIcon's Black Pixels to White Pixels?

家住魔仙堡 提交于 2019-12-11 17:11:56
问题 I know I could just change it in a photo manipulation software, but I want to learn to do it programmatically so I can change it to any color I wish. First off, I'd like to say that I've been searching for the solution around two hours and I couldn't find one that works for me, or one that deals with my exact problem. I've downloaded some icons from the internet and they're originally black with transparent background, which is good for menu bars and stuff. But, they're hard to notice on my

I am reading an image and changing it. But the changes are not being saved

ぐ巨炮叔叔 提交于 2019-12-11 13:54:01
问题 I am trying to implement a steganography. I am reading an image "a.jpeg" and inserting a byte in it by changing its consecutive 7 bytes at the least significant bit starting from offset 50. This is done successfully as when I print the bytes the last bits are changed accordingly. Then I saved it as "ao.jpeg". But when I am reading the byte values from 50, they are not the same as the once i saved. here's my code public static void main(String[] args) throws IOException { BufferedImage

Reading Grayscale PNG image files without distortion

穿精又带淫゛_ 提交于 2019-12-11 12:56:53
问题 I need to read and process a large number of PNG files that are grayscale. By that I mean that if they are opened in either Photoshop or GIMP, the image mode is Grayscale - not an RGB image with grayscale values. ImageIO does not seem to achieve this. It appears to treat all image files as sRGB. This mangles grayscale values. I need to read and process these PNG files where (in my code) each pixel has exactly the same value as if I had opened the grayscale file in Photoshop or GIMP. Does

Need Help In Solving Rotation Image Problem

假装没事ソ 提交于 2019-12-11 12:23:43
问题 I need your help please. I have spent hours trying to solve it but not working. I have an image i am rotating when the user clicks on a button. But it is not working. I would like to see the image rotating gradually till it stops but it doesn't. This it what it does. After i click the button, i don't see it rotating. But when i minimize and maximize the main window, i see the image just rotate(flip) fast like that. It does the rotation but i don't see it as it is doing. It just rotate in a