The story started with business requirement with one of the phase to convert Scalable Vector Graphics to .PNG format.
The first step to achieve any level "Google it".....So not being an exceptional did so.
Guess what??
Google gave the answer , the use of Apache Batik.
Before implementing this I had already played with the conversion of other formats of images to .png and believe me it was not a rocket science ....Simple used Java Image IO API and three lines of conversion and three lines of imports, I reached the Moon.
Lucky me!!
But the real task was .SVG to .PNG , googling and googling and googling, each website answered use of Batik then let it be "thinkbit, stackOverFlow, GitHub...." I am not mentionting URL's...google it..in a stroke you will get...
Now after surfing such a giants..Obviously, blindly follow them.........................
Started to implement Apache Batik, three maven dependencies Batik-transacode, Batik-awt-util, Batik-util....it's was not an end....
Import all along with pngTransacoder ...oops 8-9 lines code with different different implemetations..it's ok...all that ends well is good....
WAOOOOO..... Image converted...Hurray!!!
It is corrupted :(
Unfortunately, or better word fortunately, my loop went in one of the wrong conditions, THE DAY WAS MINE.....
Wrong loop expected result....Suddenly I saw wait what is this another .png image with the same name doing here.........debug it!!!
Guess what????
The image was formed with simple use of JAVA IMAGE IO API as I did at the time of other conversions.......means that my little three line code rocked!!!!!
If you don't believe me, try it yourself...every search result will answer you Apache Batik, May be I am wrong but just try:
BufferedImage input_image = null;
The first step to achieve any level "Google it".....So not being an exceptional did so.
Guess what??
Google gave the answer , the use of Apache Batik.
Before implementing this I had already played with the conversion of other formats of images to .png and believe me it was not a rocket science ....Simple used Java Image IO API and three lines of conversion and three lines of imports, I reached the Moon.
Lucky me!!
But the real task was .SVG to .PNG , googling and googling and googling, each website answered use of Batik then let it be "thinkbit, stackOverFlow, GitHub...." I am not mentionting URL's...google it..in a stroke you will get...
Now after surfing such a giants..Obviously, blindly follow them.........................
Started to implement Apache Batik, three maven dependencies Batik-transacode, Batik-awt-util, Batik-util....it's was not an end....
Import all along with pngTransacoder ...oops 8-9 lines code with different different implemetations..it's ok...all that ends well is good....
WAOOOOO..... Image converted...Hurray!!!
It is corrupted :(
Unfortunately, or better word fortunately, my loop went in one of the wrong conditions, THE DAY WAS MINE.....
Wrong loop expected result....Suddenly I saw wait what is this another .png image with the same name doing here.........debug it!!!
Guess what????
The image was formed with simple use of JAVA IMAGE IO API as I did at the time of other conversions.......means that my little three line code rocked!!!!!
If you don't believe me, try it yourself...every search result will answer you Apache Batik, May be I am wrong but just try:
BufferedImage input_image = null;
input_image = ImageIO.read(new File("Convert_to_PNG.svg")); //read svginto input_image object
File outputfile = new File("imageio_png_output.png"); //create new outputfile object
ImageIO.write(input_image, "PNG", outputfile); //write PNG output to file
Dear you will rock!!!