Add to image file

I wrote a program that takes a “photo” and for each pixel that it selects to insert an image from a number of other photos. The selected image is a photograph from which the average color is close to the original pixel from the photograph.

I did this by first averaging the rgb values ​​from each pixel in the “stock” image, and then converting it to CIE LAB so that I can figure out how to “close” it for the pixel in question in terms of human perception of color.

Then I compiled an image in which every pixel in the original “photo” image was replaced by the “closest” image of the stack.

It works beautifully and the effect is good, but the image size in the warehouse is 300 by 300 pixels and even with the flags of the virtual machine "-Xms2048m -Xmx2048m", which yes, I know it's ridiculus, by 555 pixels by 540 pixels the image I can replace Only stock images reduced to 50 pixels before I get the error from memory.

So basically I try to think about solutions. Firstly, I think that the image effect itself can be improved by averaging each 4 pixels (2x2 squares) of the original image into one pixel, and then replacing that pixel with the image, since in this case small photos will be more visible in a separate print This should also allow me to draw larger stock images. Does anyone have any experience with this kind of image manipulation? If so, what tricks did you find to create a nice image.

, , , , . ? .

.

,

+5
3

API Java Advanced Imaging (JAI). , BufferedImage , : , . " ". , . - .

JAI .

  • .
  • .

, , . "operator", . , . , , "crop, resize, composite" . , - , .

API pull-based. , - . , .

, , 2048 x 2048 , 512x512 , 1600x512 . , 1600x512, 2/3 . " " (ROI) . ROI .

. , . , BufferedImage . .

JAI, . BufferedImage , , .

, 2048x2048 . , 256x256, 64 . JAI , . , 512x512 64 64x64 .

, , , . , . -, . -, , , .

, JAI .


:

  • , . , BufferedImage , .
  • JAI JAI Image I/O JPEG, . JDK, . ( , . .)
  • ROI, . API JAI. , , , concurrency.
+3

, ;

. - , , , :

0,0,image123.jpg
0,1,image542.jpg
.....

( , ), , .

, , , . , - Java Image. , , 2GB, sqrt (2x10 ^ 9). , , . .

+2

, "", , , (.. String StringBuilder)?

, , -, , .

0
source

All Articles