There are many libraries for saving images in GIF format, but is there a library with support for GIFs more advanced (or archaic and forgotten if you will) features?
I am thinking about the plain text extension, as well as the ability to redraw only portions of the image for each new frame. The plain text extension could theoretically be used to complement image drawing as well and improve compression of animations, for instance.
I.e. (a)buse the plain text extension to render graphics instead of text. (Most languages would do.)
GIFLIB should have everything from GIF
Is this what you mean about plain text?
http://giflib.sourceforge.net/gif_lib.html#idp4823712
Here is the partial frame update
http://giflib.sourceforge.net/gif_lib.html#idp79616
For .NET (full disclosure, I work at Atalasoft) DotImage Photo Free can do the portion redraw. Look at GifFrame and GifFrameDisposal. You specify what to do with the previous frame when you draw the new one. Each frame can be any size and positioned, so you can draw only a portion of the image.
Related
I'm showing an Image on a Canvas using JavaFX, but I would like the color of certain parts of the image to vary based on a variable. Ordinarily, I imagine this would be accomplished by creating a color mask and adding that to the image, but as far as I can find JavaFX Image doesn't allow any operations like that, and from the documentation it looks like JavaFX Images can only be loaded from a file. I don't want to modify and then reload the file each time the color changes, because that seems pretty inefficient performance-wise.
My goal is to create an interactive offline app in which a small character is shown, and the user can (for example) use an input to change the characters eye/hair color.
Are there any ways to accomplish this? Essentially doing basic image masking/coloration with JavaFX Images and canvases. (Not ImageView)
Thanks for any advice you can give me!
All the images in my app are currently jpg or png, which used to be okay. The GUI was a fixed size appropriate for whatever screen it would be displayed on and everyone was happy.
Now that hi-res and retina displays are more common, the app at its normal size looks small on some screens (or fuzzy if resized), so I'd like to update the graphics to adapt to any future resolution advances by converting them to vector images (eps or svg).
Before I go do this, does JavaFX have a way to use vector images in a similar way to ImageViews? It looks like ImageView itself only supports JPG, PNG, BMP, and GIF.
No JavaFX does not support things like SVG directly but there are solutions like:
- SVG to FXML
- useage of a webview
BTW Image supports hi-res by using #2x notion eg you supply image.png and image#2x.png and JavaFX choose the right one depending on the screen resolution
I have an image saved as byte array, which is already rendered and will fit perfectly into my GUI application (no filtering, rotation, resizing or color transformation is needed). What is the fastest way to show the image?
I'm not sure what Swing is doing internally with the image before it actually shows it. But I try to bypass all these steps and directly show it without any additional Swing processing. Can you think of a way to do this?
I have a play framework application which I want to be able to produce a product label from. I have the label design in illustrator. It consists of a black circle, white writing with a QR code in the middle, also has curved text.
I want to create a high resolution PDF and/or image file of this design on the fly. All most all of the drawing stuff I find for java relates to swing.
Anyone done this?
The basic class which allows creating an image programatically is BufferedImage and the corresponding Graphics2D class. You are not forced to use it with Swing. You can easily convert it to common graphic formats like PNG. Then you can save it as an image file or place it in a generated(e.g. with iText) PDF.
http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html
http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html
In other words - yes, it can be done.
But if I ware you I would consider exporting the design from Illustrator to a file and use it as a resource in your application. But if you need to scale it programatically you ought to consider using SVG format to avoid loosing quality. Java does not have build-in support for vector images so you should look at
Apache Batik
I have spent a bit of time researching about whether it is possible to draw on top of a VLCJ movie within a Java application. I have found a few bits of conflicting advice some saying it is not possible and some referencing articles which have moved on oracle.com.
Can someone clarify if it is or is not possible to draw java2d graphics like rectangles/lines which also have transparent backgrounds so the video stream underneath can be viewed whilst the shapes are present on screen?
If this is not possible with vlcj what would be a good alternative for a linux and windows compatible media player allowing for annotation over a playing video stream? Please note i do not have to be limited to java but something where i can get re-use out of developed drawing routines for multiple platforms would be ideal.
Yes, you can do it. For the normal hardware rendered video player, you need to have at least Java 6u10 (preferably 7) and achieve this by overlaying a transparent JWindow on top of the VLC canvas (it's not too hard to add events to the canvas to check for updates in position / size and then move the overlayed window correspondingly.)
The other way that doesn't involve using overlaid windows is to use a DirectMediaPlayer, where you have access to the framebuffer directly (and can therefore do what you like with the pixels, including wrapping them as textures round 3D objects and so on.) So with this approach, you could simply draw what you wanted onto the frame buffer before rendering it to screen in the way you chose. This is the most flexible approach, but comes with the downside that if you're not very careful about your implementation, you lose all the GPU acceleration and end up crippling the CPU, especially for HD video.
If a simple overlay would do the trick, I'd try that first, and just resort to a DirectMediaPlayer if you have to.