java library to create, convert or edit images - java

I have to create thumbnails with images uploaded by my users. The image formats can be PNG, JPG, GIF. I gave a try to java.awt and javax.imageio but it is hard to deal with all the cases (image too large, image too small, image in XXX format, image with transparency...). I would prefer a library simple and not so verbose.
What java library do you use to convert / edit / create images ?

you might like to explore JMagick

Well, we use ImageIO and Apache Sanselan, but JAI or - if you don't mind using native libaries - jmagick should do as well.
image too large, image too small, image in XXX format, image with transparency
I'm not sure there is a library that doesn't have constraints like that. Since the images might be PNG, JPG or GIF, the format problem shouldn't apply.
Transparency is format dependent and thus should not depend on the library.

I chose Scalr, not need for extra ImageMagick or JNI wrapper :
http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/
On the other hand, quality is better with JMagick (if you can compile it and make it work)

Snowbound has the RasterMaster Java Imaging SDK. There is a decompress_bitmap call that will read in PNG, JPG, GIF and many other formats. The IMG_resize_bitmap_bicubic method can then be used to make a nice thumbnail.
You can go to Snowbound and push the "free trial" button to get a 30-day free trial version. The SDK comes with a Thumbnails code sample. If you want to learn more about the methods above before you expose your email address you can view the online documentation at RasterMaster.com.
Full disclosure - yes, I work for Snowbound.

Related

Libdmtx vs ZXing for DataMatrix Decoding?

How reliable is ZXing's barcode localization for DataMatrix decoding compared to libdmtx?
I have a set of png image files of stickers (proprietary, so unfortunately I'm not able to share them) containing DataMatrix barcodes. These stickers sit on flat surfaces, have very nice quiet zones and are generally centered in the image, but suffer from inequal lighting conditions and slight dust, likely the largest obstacle to reliable decoding.
I'd like to use a modifiable Java library to decode them and it seems that ZXing is the only open-source option (open to other suggestions). However, upon running these images through the ZXing online decoder, I consistently get NO BARCODE FOUND, even on the cleanest images. In contrast, when I run the same images through proprietary online decoders, like Inlite's Free Online Barcode Reader, I get reliable decodes for all the images. My company has implemented a library in C that also reliable decodes the barcode images by processing them and calling libdmtx. Similarly, this online DataMatrix decoder built on libdmtx can also reliably read my image files.
Is the barcode localization in ZXing significantly inferior to libdmtx?
If I attempt the same preprocessing on the image files before I run them through ZXing, could I achieve similar results? I have a strong preference for a Java library (ZXing), but I may have no choice but to use libdmtx. Would appreciate any insight, thanks!
I had similar problem as you but on encoding side. As per my findings Zxing is certainly inferior to Libdmtx. We are using both libraries in house in C++ and Java project.
There is a case when Zxing breaks while generating barcode look at my comments here:
https://github.com/zxing/zxing/issues/624
However Libdmtx works flowless. The other free options you have in java world are (they are for encoding):
barcode4j
OkapiBarcode
Another alternative is the relatively new ZXing cpp port here: https://github.com/nu-book/zxing-cpp.
It contains a completely new DataMatrix detector that was meant to fix serious limitations of the Java upstream version. It was specifically designed to deal with low resolution images (module size as low as around 2 pixels) and symbols that have just the required 1 module quite zone and a busy background.
The following comparison is certainly not 'fair' but I just had the dmtxread utility of the libdmtx try my test set of images and it missed 3 of 17 samples and took a whooping 300 times as long compared to my code :).

How to compress any picture?

Our site have a posibility to load user pictures. User can load absolutely any file(we believe that it will a picture at the moment). On page we show a lot of pictures thus we have a huge internet traffic. we want to compress pictures on server. I have found following article about picture compressing.
How to compress jpg file?
But there are explained how to compress concrete format. Is there universal way for compressing any picture?
A picture is a very broad term that could also include vector graphics, pictures that are in a format that browsers usually can't display (like psd files).
I would recommend to use the gd lib or imagemagick on the server side to convert them all (or at least these that are supported by your choice) to a standarized format (like jpg) that can be displayed in a webbrowser and get compressed (maybe also resized).
100% of possible image files a user could upload can't be converted afaik.

How can I convert image sequence to quicktime movie?

I have been searching on this. I Need to build an independent utility that should:
Convert image sequence to .mov format
Take input from user and display it inside the mov.
I plan to do this using Java since this is a cross platform language.
How to do it?
See JpegImagesToMovie.java it requires the x-plat version of the JMF (or more importantly jmf.jar).
For a more modern alternative, look to JFFMPEG (JMF with more formats & encodings).
I have earlier used XUGGLER for making videos from image frames. It is easy to use XUGGLER with the help of the comprehensive tutorials available here. You can also add audio to the video generated from the image frames.
Xuggler supports a large number of video codecs and video container formats so you will have the option of creating the video in different formats, leave alone .mov. Hope this helps. I can post my own code for this utility if required.

What are some good java image processing tools or APIs?

I want to build an upload applet / desktop client that can resize - trim and then send an image to my amazon s3 bucket.
Trimming my images has proven to take the longest and be the most cpu intensive. On my server when a user uploads a image using an html form I use imagemagick command line tools to do the trim and resize.
What tools would you guys recommend using?
Edit: I need to be able to automatically crop images. Something similar to the imagemagick trim function.
I would recommend that you check out JAI.
Specifically check out the classes CropDescriptor, ScaleDescriptor and their static methods.
Also, take a look at the subclasses of OperationDescriptorImpl, they will give you an idea of the types of operations JAI is capable of.

Extracting image pixel values in google appengine

I am working on google appengine to create a tool for comparing image similarity.
I need to extract the pixel values of each image to perform this.
Unfortunately appengine does not support the java image libs.So I am unable to proceed.
Is there any appengine safe image library in java capable of extracting image data?
I saw some techniques in python but dont want to switch to python if I can do it in java somehow...
GAEJ has its own graphic library with fairly limited features and java.awt.image.BufferedImage is a restricted class (ie, java.awt.Image is not supported and still not present in the Jre Class White List ).
There's an open issue here, that you might want to star.
EDIT:
Somebody has patched pngj to work with InputStream.(You could use it to read a PNG pixel by pixel)
The new version of pngj now an alternative pngj-sandbox.jar that only references whitelisted classes, it should run in google-app-engine.
can https://github.com/witwall/appengine-awt help to you? i believe it willbe enough to add theis lib as dependency to the project to make BufferedImage working (but havent' tried this yet)

Categories