How to convert PNG image to Vertor Image to make font on Mac
Hi Mac People,
I like to create a set of font, and I have made them in a image editing tool, I have FontForge downloaded but decide to use it to convert instead direct design them inside.
So now I don't know how to convert the PNG image to vector image required by the FontForge, I read some post mentioned Ubuntu has utilities to convert, but I'm not sure OS X has that function too.
Could anyone let me know how to convert PNG so I can create my fonts?
If PNG can't, the software can export TIFF or jpeg or similar.
Please help me, I need make them this few day.
Thanks everyone for giving me a hand!
take a look at:
http://developers.sun.com/techtopics/mobility/midp/articles/picture/
Similar Messages
-
How to convert base64 data to an image
Hello, my enterprise application is receiving base64 enocoded image data in an xml file. Now I need to convert it to a native image formats like jpeg/jpg/tiff/pdf etc. Does anybody know if there are any Java apis (both free/paid) which let you do this. Actually I would not have any idea of what type of image it was when it was initially encoded to base64 format. I am looking for an API/technique that can convert base64 data to any image depending on what I want at runtime.
Thanks a lot in advance.
RHi there,
I've had to deal with exactly the same problem myself. The images I had to deal with were all TIFF files, and that was okay, I'd say one of your first steps would be to find out what format these images are in.
I used a SAX Content Handler to pull the base 64 image data out of the XML into a String, and then converted the Base 64 String into a byte array. From there I could either simply write the byte array to a file, or if I wanted use ImageIO to create an Image object, work with the metadata or even save it in a different format, though I never actually did that.
Anyway, here is some code I whipped up to convert the String to a byte array, then write the byte array to disk. Let us know how you get along!
* Writes a byte array to a file.
* @param result String containing base64 image data
* @param fileName File name to write the converted image to
public static void writeTiff(byte[] result, String fileName) throws IOException {
FileOutputStream out = new FileOutputStream(fileName, true);
out.write(result);
out.close();
* Converts a String of base 64 image data, captured from XML, into a byte array.
* @param image A Base 64 String
* @return byte[]
public static byte[] convertTiff(String image) throws IOException {
byte[] result = new sun.misc.BASE64Decoder().decodeBuffer(image);
return result;
} -
How to convert raster tiles into buffered images?
Abstract:
Using the code below i try to render four tiles of an image and then store them in different files. Problem: Only the tile 0,0 gets rendered correctly.
SunTileScheduler sts = new SunTileScheduler(4,0,0,0);
sts.scheduleTiles(img, new Point[]{
new Point(0,0)
, new Point(0,1)
, new Point(1,0)
, new Point(1,1)
}, new TileComputationListener[]{
new TileComputationListener() {
public void tileComputed(Object obj, TileRequest[] atilerequest, PlanarImage planarimage, int i, int j, Raster raster)
Hello
I am using JAI to create a RenderedOp object named img and then call the TileScheduler to render me four tiles. Appearantly the scheduler tiles in 512x512, so the Point Array should render the pixels from 0,0 to 1024, 1024 spread accross four tiles.
Unfortunatly only the tile 0,0 (-> pixels 0,0,511,511) gets rendered correctly, the other three are black and take 4725 bytes each in the file system. Tile 0,0 takes ~95k
The TileComputationListener returns a Raster object that i convert into a BufferedImage:
BufferedImage image = new BufferedImage(raster.getWidth(),raster.getHeight(), BufferedImage.TYPE_INT_RGB);
image.setData(raster);After that i write the image into the file system
String fileName = String.format("d:/temp/tile/tiles_%s_%s.jpg", i,j);
try
FileOutputStream stream = new FileOutputStream(fileName);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream);
JPEGEncodeParam encodeParam = encoder.getDefaultJPEGEncodeParam(image);
encodeParam.setQuality(1.0, true);
encoder.setJPEGEncodeParam(encodeParam);
encoder.encode(image);
stream.flush();
stream.close();Tiles seem to be problematic because this constructor
public BufferedImage (ColorModel cm,
WritableRaster raster,
boolean isRasterPremultiplied,
Hashtable<?,?> properties) {rejects Rasters whose tile index is != 0,0. So it all boils down to this:
How do i convert a Raster objects into a BufferedImage?
Regards
MarkWritableRaster wr = (WritableRaster) raster;
WritableRaster newRaster = wr.createWritableTranslatedChild(0,0);
BufferedImage image = new BufferedImage(planarimage.getColorModel(),
newRaster,false,new Hashtable()); -
How to convert .pngs to jpeg....
Ok i have about 70 imgs i brought into the library in Flash CS5. Now the SWF is to big bc there all .png files, i tried to go into properties and change there .png to .jpeg but its a very looooong process, is there any way to highlight them all and either change them but updating the .pngs to .jpeg files ?
ThanksHi bob, This is a feature that's available in PShop and i have used that many times, i want to take the images in Flash and convert them to jpeg, such as if i go to an image in the library and right click (Google what right clicking is you MAC users...ahem ) and i have options to update or hit properties. I want to update and take that .png file that's in the library and update with an.jpg file (one.png > one.jpeg) but now that im going into it more im thinking i have to redo it because what im asking defines some rules..
-
How to convert FLAC 24bit 96hHz to AIFF 24 96kHz on a mac ?
I'd like to convert FLAC files to AIFF files so i can import them to my iTunes Libraby without any quality loss.
Sarasota Joe wrote:
Thank you ed2345 for HDTracks.com. iTrax.com. They are both excellent!
I have downloaded hi-def formats at Linn Records; the quality is outstanding, but their selection is limited. I'm also a member of B&W's Society of Sound; A Peter Gabriel curated Music club that get's me one London Symphony Orchestra download and one "Whatever Peter thinks is ineteresting this month" download. For $60 a year I get 24 plus hi-def albums, most of which I like a lot. But the selection at HDTracks and iTrax is excellent - Thank You!
Sarasota Joe,
You are welcome. Enjoy the music!
Ed -
How to convert 24bits png image into 8 bits image
Hi,
I have gone through some of threads in this forum on changing color bits. But, I still can find right way to change my image (24bits) into different color bits(8 bits). The reason i want to change the color bits because I am getting a GIF image from map server, convert it into PNG format then rescale then into size of mobile phone screen.The PNG image is really has large data length , so the it took a while to load the whole image on screen.
Note : The following code is taken from few threads in this forum and i have modified it to suit my application.
I have no idea about Java2d...any help really appreciated...Thanks in advance!!!
My code is as follow:-
public File Scale(int width, int height, BufferedImage ImgSrc)
try
//BufferedImage bi = ImageIO.read(ImgSrc);
//int w = bi.getWidth(), h = bi.getHeight();
//Image oldRescale = bi.getScaledInstance(i, j, Image.SCALE_SMOOTH);
BufferedImage Rescale = rescale(ImgSrc, width, height);
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
//Rescale = op.filter(Rescale, null);
File outfile = new File("map.png");
ImageIO.write(Rescale, "png", outfile);
BufferedImage fromFile = ImageIO.read(outfile);
ColorModel cm = fromFile.getColorModel();
System.out.println(cm.getClass() + ", bits/pixel=" + cm.getPixelSize());
catch(Exception e)
e.printStackTrace();
return new File("map.png");
public static GraphicsConfiguration getDefaultConfiguration()
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
return gd.getDefaultConfiguration();
public static BufferedImage copyRescaled(BufferedImage tgt, BufferedImage src)
Graphics2D g2 = tgt.createGraphics();
int w=tgt.getWidth(), h=tgt.getHeight();
hintForBestQuality(g2);
g2.drawImage(src, 0, 0, w, h, null);
g2.dispose();
return tgt;
public static Graphics2D hintForBestQuality(Graphics2D g2)
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
return g2;
public static BufferedImage rescale(BufferedImage src, int w, int h)
int transparency = src.getColorModel().getTransparency();
GraphicsConfiguration gc = getDefaultConfiguration();
BufferedImage tgt = gc.createCompatibleImage(w, h, transparency);
return copyRescaled(tgt, src);First, we need to be clear about what you're trying to do -- is it rescale an
image or insure that the image is saved with a 8bit pixel depth? Or both? You are also
using GraphicsConfiguration's createCompatibleImage, which is excellent if you are going
to display the image immediately because it might be hardware accelerated
or compatible with hardware format, but you mentioned mobile phone screens, so
there is no advantage to using GraphicsConfiguration in that case, and if fact, it's
probably changing your ColorModel when you're not looking.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
public class Example {
public static void main(String[] args) throws IOException {
URL url = new URL("http://java.sun.com/developer/technicalArticles/GUI/JavaServerFaces/fig2.gif");
BufferedImage image = ImageIO.read(url);
System.out.println("image's colormodel = " + image.getColorModel().getClass());
BufferedImage rescaled = scaleAndConvertColorModel(image, 0.75, null); //GIF => IndexColorModel
System.out.println("rescaled's colormodel = " + image.getColorModel().getClass());
File png = new File("junk.png");
ImageIO.write(rescaled, "png", png);
BufferedImage fromFile = ImageIO.read(png);
System.out.println("fromFile's colormodel = " + image.getColorModel().getClass());
JPanel cp = new JPanel(new GridLayout(0,1));
addTo(cp, image, "original image");
addTo(cp, rescaled, "rescaled image");
addTo(cp, fromFile, "png file image");
JFrame f = new JFrame("Example");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setContentPane(cp);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
Will rescale and convert colormodel if necessary.
ColorModel == null => don't convert. May return src if suitable.
public static BufferedImage scaleAndConvertColorModel(BufferedImage src, double scale, ColorModel cm) {
int w0 = src.getWidth();
int h0 = src.getHeight();
int w = (int) (w0 * scale);
int h = (int) (h0 * scale);
ColorModel cm0 = src.getColorModel();
if (cm == null)
cm = cm0;
if (w==w0 && h==h0 && cm.equals(cm0))
return src;
BufferedImage tgt = createImage(w, h, cm);
Graphics2D g = tgt.createGraphics();
if (scale < 1) {
Image temp = src.getScaledInstance(w, h, Image.SCALE_AREA_AVERAGING);
g.drawImage(temp, null, null);
} else {
hintForBestQuality(g);
g.drawRenderedImage(src, AffineTransform.getScaleInstance(scale, scale));
g.dispose();
return tgt;
public static BufferedImage createImage(int w, int h, ColorModel cm) {
if (w <= 0 || h <= 0)
throw new IllegalArgumentException("...");
boolean alphaPremultiplied = cm.isAlphaPremultiplied();
WritableRaster raster = cm.createCompatibleWritableRaster(w, h);
return new BufferedImage(cm, raster, alphaPremultiplied, null);
public static Graphics2D hintForBestQuality(Graphics2D g) {
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
return g;
static void addTo(Container c, BufferedImage image, String title) {
JLabel label = new JLabel(new ImageIcon(image));
label.setBorder(BorderFactory.createTitledBorder(title));
c.add(label);
} -
How can I use or convert a imaq image to plot images back on waveform graph
Hi
I am currently opening and manipulating (rotate and resize) a PNG image using IMAQ Vision in LabView 8.2.1 This works well and I can display the Image on the front panel using a IMAQ Image Control.
In addition to this I would now like to display the image as a background on waveformgraph. I can do this with the original PNG file by reading it and then flatten it to a pixmap ie make it a Picture but this is of little use as I need to use the manipulated IMAQ image.
Therefor I would like to know how to convert the manipulted IMAQ Image to right Picture Format (without resaving) in order to use it on the PlotImages.Back property node of a wavefrom graph.
I very much welcome your suggestions as I feel it should be easy yet can not seem to solve it. Thank you for your time!!!Hi Randall
Apologies for replying somewhat late but I have been out of the office for a few days.
Your suggestions and code helped me greatly and led to solving my query so thank you for that.
There is one more thing (well many many more but I will place new posts for those however that you might be able to answer for me.
Following your suggestion to use the image to array function I searched through more examples and found the code that did exactly what I wanted to do. Please see attached.
In this code a For loop is used to add 65793 to the color table. It works very well but I do not know why it is used exactly. Can you exlplain? I also realize I never made it clear that I use grayscale PNG files rather then color images.
Thanks again for your excellent help, it is much appreciated.
Attachments:
IMAQ_8-bit_to_picture v1.vi 15 KB
Test Image.png 42 KB -
Hi,
We have employee photos(JPG Format) stored in Content server. And now we want to print the photos in smartforms. For this I had written the below code to read the photo from content server in binary format as below.
REPORT ZTEST1.
PARAMETERS P_PERNR TYPE PERNR_D.
DATA: PS_CONNECT_INFO TYPE TOAV0,
IT_BINARY TYPE TABLE OF SDOKCNTBIN.
CALL FUNCTION 'HR_IMAGE_EXISTS'
EXPORTING
P_PERNR = P_PERNR
* P_TCLAS = 'A'
* P_BEGDA = '18000101'
* P_ENDDA = '99991231'
IMPORTING
* P_EXISTS =
P_CONNECT_INFO = PS_CONNECT_INFO
* EXCEPTIONS
* ERROR_CONNECTIONTABLE = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
IF PS_CONNECT_INFO IS NOT INITIAL.
CALL FUNCTION 'SCMS_DOC_READ'
EXPORTING
STOR_CAT = SPACE
CREP_ID = PS_CONNECT_INFO-ARCHIV_ID
DOC_ID = PS_CONNECT_INFO-ARC_DOC_ID
* PHIO_ID =
* SIGNATURE = 'X'
* SECURITY = ' '
* NO_CACHE = ' '
* RAW_MODE = ' '
* IMPORTING
* FROM_CACHE =
* CREA_TIME =
* CREA_DATE =
* CHNG_TIME =
* CHNG_DATE =
* STATUS =
* DOC_PROT =
TABLES
* ACCESS_INFO =
* CONTENT_TXT =
CONTENT_BIN = IT_BINARY
* EXCEPTIONS
* BAD_STORAGE_TYPE = 1
* BAD_REQUEST = 2
* UNAUTHORIZED = 3
* COMP_NOT_FOUND = 4
* NOT_FOUND = 5
* FORBIDDEN = 6
* CONFLICT = 7
* INTERNAL_SERVER_ERROR = 8
* ERROR_HTTP = 9
* ERROR_SIGNATURE = 10
* ERROR_CONFIG = 11
* ERROR_FORMAT = 12
* ERROR_PARAMETER = 13
* ERROR = 14
* OTHERS = 15
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF
Now the issue is I want to convert that binary data to bitmap image and upload the same in to SE78. So that I can use that BMP image from SE78 in my smartforms.
I had used the class CL_IGS_IMAGE_CONVERTER to covert the image into bmp but it is giving error that error in IMAGE DATA CORRUPT & Error Code 3. The conversion code used is as below.
******* CONVERT THE JPG IMAGE INTO BMP PHOTO. **********
DATA: L_IGS_IMGCONV TYPE REF TO CL_IGS_IMAGE_CONVERTER,
L_IMG_BLOB TYPE W3MIMETABTYPE,
L_IMG_SIZE TYPE W3PARAM-CONT_LEN,
L_IMG_TYPE TYPE W3PARAM-CONT_TYPE,
L_IMG_SUBTYPE TYPE W3PARAM-CONT_TYPE,
L_IMG_URL TYPE W3URL,
L_ERR_CODE TYPE I,
L_ERR_TEXT TYPE STRING,
P_DEST TYPE CHAR32 VALUE 'IGS_RFC_DEST'.
DATA: G_IMG_BLOB TYPE W3MIMETABTYPE,
G_IMG_TYPE TYPE W3PARAM-CONT_TYPE,
G_IMG_SIZE TYPE W3PARAM-CONT_LEN.
IF NOT IT_BINARY[] IS INITIAL.
G_IMG_BLOB[] = IT_BINARY.
CREATE OBJECT L_IGS_IMGCONV
EXPORTING
DESTINATION = P_DEST.
CALL METHOD L_IGS_IMGCONV->SET_IMAGE
EXPORTING
BLOB = G_IMG_BLOB
BLOB_SIZE = G_IMG_SIZE.
CASE PS_CONNECT_INFO-RESERVE.
WHEN 'TIF'.
G_IMG_TYPE = 'image/tiff'.
WHEN 'JPG'.
G_IMG_TYPE = 'image/jpeg'.
WHEN 'PNG'.
G_IMG_TYPE = 'image/png'.
WHEN 'GIF'.
G_IMG_TYPE = 'image/gif'.
WHEN 'BMP'.
G_IMG_TYPE = 'image/x-ms-bmp'.
WHEN OTHERS.
EXIT.
ENDCASE.
L_IGS_IMGCONV->INPUT = G_IMG_TYPE.
L_IGS_IMGCONV->OUTPUT = 'image/x-ms-bmp'.
* PERFORM GET_SIZE USING PICTURE_CONTAINER
* L_IGS_IMGCONV->WIDTH
* L_IGS_IMGCONV->HEIGHT.
CALL METHOD L_IGS_IMGCONV->EXECUTE
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC IS INITIAL.
CALL METHOD L_IGS_IMGCONV->GET_IMAGE
IMPORTING
BLOB = L_IMG_BLOB
BLOB_SIZE = L_IMG_SIZE
BLOB_TYPE = L_IMG_TYPE.
SPLIT L_IMG_TYPE AT '/' INTO L_IMG_TYPE L_IMG_SUBTYPE.
ELSE.
CALL METHOD L_IGS_IMGCONV->GET_ERROR
IMPORTING
NUMBER = L_ERR_CODE
MESSAGE = L_ERR_TEXT.
BREAK-POINT.
ENDIF.
ENDIF.
ENDIF.
So could you please some one help me how to convert JPEG Photo to BMP programatically.
Regards,
Mayur.johnandersonpalmdesert wrote:
My printer is requesting a vector file.
Jpeg File format does not support vectors. Photoshop has limited vector support and tools. Photoshop can not save vector file formats like SVG. What File type does your printer want?
Adobe Illustrator is Adobe vector application. -
How to convert Doc file into image
hello frnds
Can any body guide me how to convert doc file into image and show into swf loader.
actually i have to convert doc files into swf files in runtime so that i have to use this flow.
is it possible to convert doc file into byte array and than convert into image.
Thanks And Regards
Vineet OshoYou can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()
-
How to convert a image layer to a text layer any idea? a image looks like a text in layers box
How to convert a image layer to a text layer any idea? a image looks like a text in layers box
You can't convert an image into a text layer. What you can do is clip an image to a text layer so that just the image layer shows up where there is text. Create a text layer, then above it put your image layer. Hold down the alt/opt key and click between the two layers to clip them.
-
How to convert image to array pixel values in java
I would like to know how to convert image into arrary of pixels in java ?
which API should i use ?
please give me link to a sample program !I find the most efficient way to just walk over the image and call getRGB(x,y) on every pixel, more so than Pixelgrabber. If someone knows a more efficient way, give me a beep.
-
Problems converting PNG image to SVG with autotrace
Hi,
I am trying to convert a large number of color PNG images of hieroglyphs (produced after much effort) to SVG format, using "autotrace -background-color ffffff -output-format svg".
It seems that where there are closed paths with background color inside, autotrace produces an SVG image with the background area in black instead of transparency. (You can see the images at http://5b4az.chronos.org.uk/pkg/hieroglyph/A001.png and http://5b4az.chronos.org.uk/pkg/hieroglyph/A001.svg although the svg image is not rendered by Firefox). You may also download the tarballs with all the hieroglyphs of the Gardiner set if you are interested.
After all the effort that went into these images, I am stuck with being unable to convert raster images to vector graphics. I did try autotrace before I put in all this effort, but I didn't notice the problem because apparently I tried it on images with no enclosed background color.....
Any suggestions wellcome greatefully!
Last edited by neok (2009-10-17 16:59:31)I know this is an old thread, but I did some new testing on some line art and want to post my results.
I started with a PNG, and converted it to PBM and PGM. I got much better quality doing this conversion with GIMP, as opposed to pngtopnm.
I traced both formats with autotrace and potrace, which I output to SVG.
Autotrace accepts PNG, so I did the trace with the original as well.
I got the highest quality with PGM and potrace. It also was the smallest file size.
a close second was PBM with potrace, slightly larger.
third was autotrace and the PBM, larger still.
Using the PGM with autotrace was unacceptable, and the file size was HUGE!
So if black/white is OK: Convert PNG to PGM with GIMP, then potrace
both the best quality, and smallest size SVG. This is assuming you started with anti-aliased black/white line-art, i guess the full greyscale PGM avoids the aliasing of PBM.
It seems autotrace is the way to go, if your forced to deal with multiple colors.
I suspect you will need to do many passes and really tweak those command options,
The PNG directly to autotrace was a complete disaster, but i suspect it would improve given enough time to configure command arguments.
However, even with those perfect options I would believe potrace yields a cleaner trace. -
How to convert RAW images to JPG in Imagebrowser EX 1.4.0.5
I installed ImagBrowser EX so I can view my raw images. It works fine for viewing but I can't find how to convert them to raw images. The manual and help file says to go to Edit > Process RAW Images but when I go to the edit menu, there is no such option. There is only Correct red-eye, auto correct, adjust color and brightness, increase sharpness, crop imae, insert text, edit movies and extract multiple images from movie
Help?You need to install Canon Digital Photo Professional from the camera-supplied CD.
John Hoffman
Conway, NH
1D Mark IV, Rebel T5i, Pixma PRO-100, MX472 -
How to convert a 16-bit image to 8-bit
I am having difficulties in skeletonizing my image. Although I already threshold my image, it still cannot be skeletonized. When I create the image using IMAQ create, the image type must be set to 16-bit, otherwise it will create an error message. An enthusiast in the forum told me that the image must be 8-bit so that it can be skeletonized. But I do not know how to convert the image from 16-bit to 8-bit. So is there anybody out there that can provide me with a solution. Attached is the VI that I used. Really appreciate your help.
Attachments:
Image_Acquisition.vi 68 KBTry using the IMAQ Cast Image function under Motion & Vision>>Vision Utilities>>Image Management>>IMAQ Cast Image.
Regards,
Steve -
How convert Microsoft viso to JPEG Image format
Hi,
Can any one suggest me how to convert Microsoft Visio format to JPEG Image format in java.
Please write me back at [email protected]
Thanks,
MerajI believe that RAW is a generic term to mean image data that has not been processed (sharpened, compressed, saturated, etc.). RAW file formats are proprietary to the manufacturer; Nikon's RAW (NEF) is not in the same structure as Canon's RAW (CR2).
Maybe you are looking for
-
When I try to print in iPhoto it won't let me print without creating a "theme" first. Is there any way you can just print? I don't want a theme, I just want to print!
-
How to center menu and add spacing between buttons?
Here is my site: http://lauraportfolio.hostoi.com/index.html (If you are using Google Chrome you can right click and select "view page source" to see the html of the page) See how the menu button are justified the left of the light pink menu bar? How
-
Can you still download lightroom 4?
Can you still download the trial version of Lightroom 4?
-
Installing Camera Raw plugin in PSE 10
My PSE 10 did not come with Camera Raw installed. I've tried to download and install from the Adobe site but my results indicate the downlaod is not for my version. Trying to use the Help menu in PSE 10 says everything is up to date. How can I get an
-
Safari is freezing since new update.
SSince the update this morning, Safari with search results but is then frozen and I cant open any of the websites.