Java library to convert InDesign file to image (jpg, png, etc.) - java

I have a Java webapp that works with InDesign files, I need my application to be able to show a preview of the file and also to send it to the printer. Is there some library that can take the InDesign file and convert it to an image file?
Thanks.

Don't know if you've had any luck with this, but we use imagemagick for this kind of thing. It's not a java library but we access it in java via the command line, and it works really well.

Related

Reading ND2 files in eclipse

I have created a GUI using java Swing which displays some images. I have been testing it and have managed to create some labels which I have filled with JPEG images as a test.
Now, I face the problem that I cannot display the actual files i need to display because they are .nd2 files (from a Nikon microscope). I have been looking at how to use the Bio-formats and/or IJ packages to do so...but I don't know where to start.
Can anyone help? I am using the Eclipse IDE for Java
About the format
From https://www.file-extensions.org/
... The ND2 format uses JPEG-2000 compression, and also can be
uncompressed or Zip-compressed ...
As mentioned in read jpeg2000 files in java
JPEG 2000 seems to be not included inside standard Java SDK.
Potential solutions
1. Use Open JPEG + existing JNI wrapper
I would try out https://github.com/uclouvain/openjpeg and search for some java wrappers to use openjpeg (e.g. look at https://github.com/barmintor/openjpeg for an JNI approach for maven).
2. Use Open JPEG + Write own JNI wrapper
Another approach would be to look at
https://github.com/ThalesGroup/JP2ForAndroid/blob/master/library/src/main/java/com/gemalto/jp2/JP2Decoder.java , inspect involved classes etc. and write an own JNI wrapper
The mentioned github reposoitory code writes to android bitmap, so not directly usable for your Swing project, but it shows you the way to decode JPEG2000 format by native calls to OpenJPEG library
How to convert a byte[] to a BufferedImage in Java? describes conversion from byte array to a buffered image - so these information should help you to read the image data into a buffered image (so usable in Swing).

Converting .swf files to animated gifs in Java

I have a bunch of banner files in .swf format. I ultimately want to place these inside a pdf using Java. I have been successful in putting jpegs inside a pdf in Java so far.
I want to know the following things:
Is it possible to place the banner files(.swf) in a pdf using either standard java or an external library.
If the above is not possible, is it possible to convert these files into animated gifs(again with standard/external java libraries) and put it in the pdf.
I would atleast like to extract a frame from these .swf files and use it as a jpeg in my PDF.
Some PDF reader may read the swf, like Acrobat, but most won't.
You'd better be converting them.
Here is some external tools that can help you in the process: http://www.swftools.org/
As of making that with native java, it is possible, but it would require re-rendering all the SWF vector drawing, which is a quite heavy work.

How to screencast to a video file using java?

In some situations (automated testing) I need to screencast my display(s) to video file(s), but currently i can only save a series of PNG files using Robot and ImageIO classes, I know there are other third party programs to convert this set of image files into a video file but I want to make it in my code without a need to third party applications, so how to convert from a series of PNG files into a video file in any format ? Thanks in advance.
I would just get FFmpeg and use that to convert your images to video. You can make syscalls in Java if what you mean by "third party application" is "I don't want to do it manually" as FFmpeg supports command-line.
For example, maybe something like
String[] cmds = {"path/to/ffmpeg", args ... }
Runtime.getRuntime().exec(cmds);
There are many tutorials available on how to use ffmpeg to convert a sequence of images to a video file.

Decode QR codes on AppEngine Java

I'm trying to decode a QR code which is in a jpeg image, that I post to AppEngine, in the Java version.
I have tried to use ZXing, but couldn't manage to. The obvious solution would be to use their 'Javase' module, but that needs to use BufferedImage and ImageIO, which are not available in AppEngine.
Is there some alternate solution?
You could use the zxing online decoder:
QR code example:
http://thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/images/qrcode_dvp.png
php script example:
file_get_contents('http://zxing.org/w/decode?u=thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/images/qrcode_dvp.png');
A very good tutorial (in french):
http://thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/
Try bundling the BufferedImage and ImageIO jar files into the WEB-INF/lib directory of your project or perhaps the Referenced Libraries of your project in Eclipse.

Streaming video files users have uploaded

We have a java web application where users can upload all kinds of files including any kind of video files. Now we want to allow them to stream these video files they own. So I need to make sure that they are the owner and then stream video. Also possibly stream a preview.
Do I need to convert these video files before streaming and where should I look to get started?
The best video playback/encoding library I have ever seen is ffmpeg. It plays everything you throw at it. (It is used by MPlayer.) It is written in C but I found some Java wrappers.
FFMPEG-Java: A Java wrapper around ffmpeg using JNA.
jffmpeg: This one integrates to JMF.

Categories