java or javascript way to convert images file to favicon.ico - java

I am trying create a java function to convert image files such as "jpg, jpeg, gif, png" into favicon.ico. Does anyone know any library can do that? I want pure java or javascript way. Not the way using imageMagick with jni

Take a look at image4J which will allow you to create ICO images through Java
As simply as...
List<BufferedImage> listOfImages = ...;
ICOEncoder.write(listOfImages , new File("favicon.ico"));
You may also want to check out Reading/Loading an Image as well...

Disclaimer: I not aiming to Answer the question in the most efficient way, but i found an interesting possibility how to solve this problem in an unconventional manner.
with some googling i found this existing site http://mrcoles.com/favicon-creator/ (first result, for the searchterms "javascript create ico").
It has javascript code to create an ICO file, coping this code and adding some canvas html5 magic like found here, you could build the whole thing in Javascript and having lots of fun.
Just a crazy Javascript approach, from the do-it-yourself (copy-past-it-yourself) shelf. :)))

Related

converting ppt to html

I want to implement a function that can see PowerPoint on the web at this time.
You can do it simply by converting PowerPoint to an image, but if you convert it to an image, I think there are issues that you can not use video or audio.
So the idea was to convert PowerPoint to HTML and place it where I wanted. However, it does not have much ability to directly implement the pure function of converting PowerPoint to HTML. To solve this problem, I have been looking for open source or various libraries, but I have not found them yet.
The development environment is java8 + Spring Boot.
If you are OK with converting your PPT files to PDF before converting them to HTML, then pdf2htmlEX could be worth looking at. It is the best tool I could find for this kind of work, as it is capable of converting PDFs to HTML very precisely (have a look at the exmples 1,2,3,4). You should be able to find wrapper libraries in the maven repo so that you are able to call it from your Java applications.
If you are OK in using iframe you may use a Microsoft solution https://products.office.com/it-IT/office-online/view-office-documents-online
You may use this code:
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[you_ppt_url]' width='100%' height='600px' frameborder='0'>
There's an older node package called PPTX2HTML. It outputs a bunch of garbled code on a canvas element, but it might work. They even have a demo website to try it out. They seemed to have broken the powerpoint up into parseable XML and rendered the elements.

Display dicom or raw images in 3D

I was wondering what tool can I use to make a single slice (image) into 3D. I can open dicom and raw images in my program but I want to display these images in 3D (just a single image rather than the whole stack). I used some of ImageJ files to open images but I don't like how ImageJ displays the stack in 3D and it doesn't really display a single image in 3d. My program is coded in java and I would like a tool that can be easily integrated into eclipse Kepler. I have found many tools like jogl, java 3d, java 3d workbench, vtk, etc. but I don't know which one to use or are there any other programs that are easier to use or integrate into the system.
EDIT:
I want to do something like this... http://www.welfenlab.de/fileadmin/forschung/gebiete/YaDiV/2008_07_18_Screenshot_YaDiV_1.png
There's a library called ImageJ which can be used to create three-dimensional models from two-dimensional slices. I haven't personally used it, but it looks like it should do the trick.
have you looked at XTK? in particular, lesson 17 seems to be exactly what you are looking for. it is in Javascript, so to integrate into your Java application, you should be able to use one of the many Java/Javascript bridges out there.

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.

How to convert BufferedImage to AVI?

This question is an extension to my previous question:
Problems associated with my screenshot-taking software
Now with the problems solved, I want to convert the .png images to .avi file. Now the format of images and video doesn't really matter since the images are written to the disk using javax.swing.ImageIO so I can change the save format. So they are BufferedImage before being made as .png
Most questions here on similar topics were asked to use some 3rd party software and all. I want to do it using just Java.
Where do I begin?
Can you help me understand this?
If you don't mind using 3rd party libraries you might want to take look at Xuggler. It's a wrapper for ffmpeg that helped me some time ago.
Update: This demo might contain all you need: https://github.com/xuggle/xuggle-xuggler/blob/master/src/com/xuggle/mediatool/demos/CaptureScreenToFile.java

How can I use Java to take a "screenshot" of displayed HTML?

Do you know how to convert (save) HTML to an image? Any format is acceptable: jpg, png, ... I tried this code but it does not correctly convert images from HTML (<img> tag).
A solution in Java would be preferred; however, I would appreciation any approach.
Well, here is the outline of a solution, at least:
You need a HTML renderer (Gecko, Webkit et al). Then you need to capture it's "output".
The first approaches that spring to mind are
Create a batch tool yourself, using an open source rendering engine - then render this to an image. This could be done with Qt and QWebKit, maybe even with Qt Jambi (for java). There is an example for c++ here, in the Qt developer blog.
Automating an X11 browser and using capture to capture the contents of the window. Could be a problem with scrolling, IDK.
One solution would be to use WebDriver
Another solution could be provided by this article : Capture screenshots with Selenium
They are both Java solutions.
Your description is a little shy on what your trying to do. Could you please give more details?
If you are just trying to take the html and make an image of it what you might want to try is to create a new image and insert the html as text into the image. Once that is done, you can save the image to the type of your choice. I don't know if this is what you are looking for though.

Categories

Resources