Java image editor UI component - java

I'm looking for a Java library that provides a simple image editor (like MS Paint) as a UI control. If it's extendable so I can add new editing tools, that would be great. I need to be able to save the edited image in either JPEG or BMP formats. This library must be free, and ideally is open source with a license compatible with including in closed source software.
My use case is I'm using Xuggle/MediaTool to extract frames from a video file. I then need to have the user cut out certain pieces of the image to create a mask for use in a video processing routine.

It is easy to roll one on your on. If you need really advanced capabilities, probably you can embed the editor from this open source Java project.

I made a "photoshop/mspaint" like Java project here : http://imagework.free.fr contact me through the "contact" page of the website, I can help you if you need.
To answer, for write an JPG/BMP image you can use:
BufferedImage image = "your image";
ImageIO.write(image,"BMP",BufferedImage.TYPE_BYTE_INDEXED);
or
ImageIO.write(image,"JPG",BufferedImage.TYPE_INT_RGB);

Related

Is it possible to extract text from video programmatically?

I know we can extract text from image using ocr. But I need to extract the text present in video, like those in video lectures. Or in other words is it possible to transcribe a video to text. Is that possible? If so please suggest me how to do it in java or any other language.
My naive linux driven approach would be:
check: does the OCR work in my operating system?
extract some samples from the video using the normal runner. Each runner (for example VLC) has such a functionality.
check: how good is the OCR in extracting text from image files?
check: how good is the OCR in extracting text from image files with the background the video is providing?
get software to extract frames from videos in batch -> there is various software which allows to create contact-sheets, this should also be able to extract images in full resolution at abitrary points in time out of the video. Full resolution might be necessary to allow the OCR to work. Perhaps you can clip the images first, if you know, that the text is positioned in fixed rectangles.
Worst case you let OCR analyse each frame of the movie.
That mostly depends on how good and how fast your OCR is working. Everything else to me is very proven software. The language might be bash-shell-script, since the components will probably be separate linux programs. As I mentioned, it depends on the quality, performance and runtime environment of your OCR.
Yes, You can do that and there are 3 ways you can achieve it.
Split, Classify and train on your own.
Get a performance server,
A. Extract images from the video
B. Develop and Train your machine learning model. You can use tensor flow to do the same.
Note: If you prefer to train models on your own, make sure you have enough time as sometime the developing and training requires few months and you should have data to train them.
Use an OCR framework
USE API(Freemium model). There are many available in the market. Just google them and your will have many in hand.

Blurring JPG image using Java

I have an .jpg image that is generated by an application. What I want to do with it is, using java, blur out a box on the .jpg to a point where any text or content would not be able to be read, but doesn't aesthetically ruin the picture.
How would I go about doing this?
Edit:
I guess I'm needing more direction than just a simple how to do this. I don't have any background in image processing. What kind of java libraries or tools should I be looking at using?

How to read/write custom PNG metadata in Android?

I have to associate a couple of text parameters (a UUID and a couple of strings representing integers) to a PNG image in a way they can follow the image when the PNG file is passed from an Android device to another through the Net. This is the typical situation in which I would use a couple of custom auxiliary chuncks (similar to EXIF fields ) to store my data inside the PNG image itself.
Maybe it is just me but the only info I was able to find about reading and writing PNG custom metadata from Java code on Android was this SO post:
Writing image metadata in Java, preferably PNG
that even offers some code (quite verbose, as usual with Java).
Those same SO post refers also to PNGJ: http://code.google.com/p/pngj/
To be honest, I would be happy to not use yet another library in this project.
Does anybody know of others ways to write and read text metadata in a PNG file in Android? Maybe a less verbose way... Maybe a way that does not require a separated library....
Any other source of information? Any tutorial? Any example?
I'm open to use a different (but equivalent) image file format, if needed (JPEG, whatever).
A solution working also on iOS and Windows 8 Phone would be a plus but it is not actually required.
I had to do something similar lately, so I had to study the subject.
Android offers you no option of manipulating png metadata. You will have to use an external library (PNGJ seems like a good option).
In my case, since I am making changes to the Android frameworks, I didn't use an external lib, but made changes to skia (the Android graphics library instead).
If you need more info on that I can give you, but I think it's irrelevant in your case.

Good format for vector graphics for generation in java and use/open/print in windows?

We have a java web application. The application generates a big image with company structure diagramm on it as jpeg. Users download the image and want to print it on DIN A2 (big paper format). The jpeg in this scale has pretty bad quality after printing.
Our idea is to generate an image in vector graphics. What vector graphics format suits the best our needs, considering that we code in java and the users have windows and use MS IE browser?
May be there is a better way archieve this? Like let the browser to display the image and let users to print the page?
PDF has been invented exactly for the same purpose. iText library enables you to draw lines, boxes, circles and insert whatever text you like. If you want to automate it a bit using templates there's JasperReports which utilizes iText.
A well known vector graphics format is Scalable Vector Graphics. It's basically an XML file (starting with <svg> tag. It can be viewed in browsers like Firefox without additional plugins.
For java, you can use the Java 2D API to create SVG format. A tutorial can be found here:
If you need the vector graphic for IE you need VML, similar to SVG but can be rendered by Internet Explorer.
RaphaelJS can be used for vector graphics independent of browser model but it's client side and you may not want to do client side processing on every page load.

which Java / Groovy library to overlay text on an image

I am working on a web application (using Grails) which will generate a gift certificate. I'm thinking of a workflow like this:
The user will pick a template which will be stored as an image.
Then the text (name, date, amount etc) will be overlaid on the image to make the final certificate. There is a set of co-ordinates associated with each template which describes where to put each bit of text.
There is a kind of 'live preview' in the browser which shows the user what the final certificate will look like.
When the user is happy with the results, they download the certificate as a PDF and print it.
Can anyone recommend a library for Java (or Groovy) that will make it easy to do this? I'm not particularly worried about speed, as I suspect that the webapp will only be used by a few people at a time.
UPDATE: in the end I used the iText PDF library to overlay text on a PDF template using PDFStamper.
You can do this with the standard Java 2D graphics libraries - create a BufferedImage from the image, get its Graphics and use drawString() to put the text on top. Of course, the text would then be part of the bitmap in the resulting PDF, and not use the full printing resolution.
In addition to the answers above, I have come across the groovy library GraphicsBuilder and the Grails plugin j2D which are also potiential solutions.
You might consider using Batik to do this as SVG. Your image would be an <img> tag and your text would be one or more <text> tags. There's a converter (called FOP, I believe) which will get you PDF output.

Categories

Resources