Converting a WMF to a BMP
Hello,
Is it possible to convert a WMF (Windows Meta File) file to a BMP (Bitmap file) using the various .NET nodes (Constructor node, Property Node , Invoke Node)? I wil explore the various options and try some things out. Just wondering if someone out there knows how to do this.
Regards,
Kaspar
hi!
I've seen you sent a similar question some time ago: http://forums.ni.com/t5/LabVIEW/read-wmf-activex/td-p/767619
but I suppose the problem is still open.
You could try installing imagemagik (http://www.imagemagick.org/script/index.php) (and the library nedded for WMF) and do the conversion using it from the command line ("system exec")
Regards,
Marco
Similar Messages
-
How convert to jpg picture into bmp ?
Hi experts,
I am trying to convert my jpg picture into bmp. for this i write one report but showing some
TRANSFER WA_MIME1 TO DSN1.
HERE IS MY FULL CODE PLZ HELP ME.
REPORT ZSE78_7.
DATA: blob TYPE w3mimetabtype,
blob_size TYPE w3param-cont_len,
blob_type TYPE w3param-cont_type .
DATA:
p_color_scheme TYPE char20 ,
p_labels_groupid TYPE igs_label_tab,
p_labels_category TYPE igs_label_tab ,
p_data TYPE igs_data_tab,
p_charttype TYPE char20,
p_legend TYPE char20,
l_igs_chart TYPE REF TO cl_igs_chart ,
l_igs_chart_engine TYPE REF TO cl_igs_chart_engine,
i_igs_image_converter TYPE REF TO cl_igs_image_converter,
mime TYPE w3mimetabtype,
html TYPE w3htmltabtype,
html_line TYPE w3html,
l_msg_text(72) TYPE c,
l_url TYPE w3url,
l_content_length TYPE i,
l_content_type TYPE w3param-cont_type,
l_content_subtype TYPE w3param-cont_type.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'e:\katoch.jpg'
filetype = 'BIN'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
IMPORTING
filelength = l_content_length
* HEADER =
TABLES
data_tab = mime
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT i_igs_image_converter .
i_igs_image_converter->input = 'image/jpeg'.
i_igs_image_converter->output = 'image/x-ms-bmp'.
i_igs_image_converter->width = '100'.
i_igs_image_converter->height = '100'.
CALL METHOD i_igs_image_converter->set_image
EXPORTING
blob = mime
blob_size = l_content_length.
CALL METHOD i_igs_image_converter->execute
EXCEPTIONS
communication_error = 1
internal_error = 2
external_error = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL METHOD i_igs_image_converter->get_image
IMPORTING
blob = blob
blob_size = blob_size
blob_type = blob_type.
DATA dsn1(20) TYPE c VALUE 'E:\test.bmp'.
DATA wa_mime1 TYPE w3mime.
*DATA wa_mime1 TYPE w3mimetabtype.
OPEN DATASET dsn1 FOR OUTPUT IN BINARY MODE.
LOOP AT blob INTO wa_mime1.
TRANSFER wa_mime1 TO dsn1.
CLEAR wa_mime1.
ENDLOOP.
MESSAGE ' successfull' TYPE 'I'.
CLOSE DATASET dsn1.
ELSE.
DATA: num TYPE i, message TYPE string.
CALL METHOD i_igs_image_converter->get_error
IMPORTING
number = num
MESSAGE = message.
MESSAGE 'not successfull' TYPE 'I'.
ENDIF.HI
i already converted it in binary form but when i transferring it to binary mode it generate error.
the code is like this.
LOOP AT blob INTO wa_mime1.
TRANSFER wa_mime1 TO dsn1.
CLEAR wa_mime1.
ENDLOOP.
CLOSE DATASET dsn1. -
Comment convertir un .tiff en un .BMP?
Bonjour à tous
Comment convertir un .tiff en .bmp ???
je sais ouvrir un .tiff avec Imaq mais pour le reste je sèche..You should be able to use the IMAQ Read File VI to read the file in, then use the Write BMP File VI to write the file. A similar approach is used in this example: Convert PNG or JPG to BMP file
Cheers,
Misha -
Converting .bin (Binary) File to .bmp ( BMP ) File
Hi All,
I have a requirement to convert .bin file to .bmp file. The binary file is generated by the video frames and now i want to convert this binary file into the .bmp file. Can anybody help me how to do this and if possible then pls write the sample code.
-ThanksHow do you meen generated by the video frames?
Do you mean that the .bin file is created by an application in the event of a screen shot fo example?
If so then the big question is in what format did this application save the image data
Please elaborate.
Don't bank on the idea of us giving you code,
we will if possible point you into the right direction and help where required but thats about as far as we prefer to go. -
Hi, I'm writing a program and I need to convert a JPG image to a BMP. I've looked around, and Java Advanced Imaging looks promising, but it seems that if one wants to run programs made with the JAI they need to install the JAI JRE. This, unfortunately, is not an option. Is there a way I can do this without asking that my users install another JRE? Thanks.
Perhaps you can use the image I/O library (javax.imageio).
It's part of the standard JRE. -
Convert a component to a BMP-file
Hello!
I�ve tried to convert my component where I have a chart drawn to a bmp-format file. I have picked part of the code from a Sun help page. This is how it looks:
//first my lines
Image image = component.createImage(component.getWidth(),
component.getHeight());
Graphics g = image.getGraphics();
Graphics2D g2d = (Graphics2D) g;
component.paint(g2d);
//then Suns lines
ParameterBlock pb = new ParameterBlock();
pb.add(image);
PlanarImage tPlanarImage =
(PlanarImage) JAI.create("awtImage", pb);
//Then, write out the PlanarImage (for example, in BMP format):
try {
OutputStream tOutput =
new FileOutputStream(fileName);
ImageEncoder tEncoder =
ImageCodec.createImageEncoder("BMP",tOutput,null);
tEncoder.encode(tPlanarImage);
tOutput.close();
catch (IOException ex) {
Error message is:
java.lang.RuntimeException: All samples must have the same size.
at com.sun.media.jai.codecimpl.BMPImageEncoder.encode(BMPImageEncoder.java:134)
If some one could help me out I would be very grateful.
Best Regards
StaffanThanks for Your advice. I�ll then think I had to change to Java 5.0.
Best Regards
Staffan -
Mail converts all attached images to bmp
I need to send all my (attached) images as jpg or gif. but windows recipients complain they are receiving them as bmp files. i do have windows friendly setting activated.
any ideas?Are you using RTF for message composition?
If so, try using Plain Text instead. -
Java Code to Convert GIF to BMP
Hi,
Could anyone please tell me the Java Code to convert the GIF image to BMP image.
Thanks,
RathishHere is a sample code for reading an Excel file. It uses JExcel API:
package com.quicklyjava;
import jxl.*;
import jxl.read.biff.BiffException;
import java.io.File;
import java.io.IOException;
public class JavaExcelRead {
* @param args
public static void main(String[] args) {
try {
//Create a workbook object from the file at specified location.
//Change the path of the file as per the location on your computer.
Workbook wrk1 = Workbook.getWorkbook(new File("C:/test.xls"));
//Obtain the reference to the first sheet in the workbook
Sheet sheet1 = wrk1.getSheet(0);
//Obtain reference to the Cell using getCell(int col, int row) method of sheet
Cell colArow1 = sheet1.getCell(0, 0);
Cell colBrow1 = sheet1.getCell(1, 0);
Cell colArow2 = sheet1.getCell(0, 1);
//Read the contents of the Cell using getContents() method, which will return
//it as a String
String str_colArow1 = colArow1.getContents();
String str_colBrow1 = colBrow1.getContents();
String str_colArow2 = colArow2.getContents();
//Display the cell contents
System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\"");
System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\"");
System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
You can further process this to convert the data extracted into XML. Hope this helps! -
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. -
IGS COnverted BMP Image upload problem in SE78
HI Friends,
I Converted the JPEG image into BMP ormat by using IGS. It is converting properly. i am able to see the BMP image. When i am trying to upload it through the SE78 i am getting the short dump.
If convert it manually, i am able to upload the image. i did not get the any difference between these two including file size, width and height.
I attached the shortdump and converted image file as an attachment. Can anyone give me inputs where i am missing the target.
Runtime error : COMPUTE_INT_TIMES_OVERFLOW
Exception : CX_SY_ARITHMETIC_OVERFLOW
Thanks ,
Srinivas BhavanamHi Oisin,
Sorry for the Late Reply. I am using IGS 6.40 with solaris system.
If i am converting the image from my desktop i am getting 96DPI resolution. Where as if i am doing it from IGS i am getting 30682172 DPI resolution.
I am using SAP 4.7. Is it the latest patch level or latest IGS supported.
Short Dump :
Runtime Error COMPUTE_INT_TIMES_OVERFLOW
Exception CX_SY_ARITHMETIC_OVERFLOW
Occurred on 03.03.2010 at 11:04:30
Whole number overflow on multiplication.
What happened?
Error in ABAP application program.
The current ABAP program "SAPLSTXBITMAPS" had to be terminated because one of
the
statements could not be executed.
This is probably due to an error in the ABAP program.
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_ARITHMETIC_OVERFLOW',
was neither
caught nor passed along using a RAISING clause, in the procedure
"FILL_BMFILE_FROM_BMP" "(FORM)"
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
In the current program "SAPLSTXBITMAPS", multiplying the numbers 1207959552 and
100 (using the operation * or 'MULTIPLY') resulted in a value
greater than 2147483647 or smaller than -2147483648. This
results in a whole number overflow.
How to correct the error
The exception must either be prevented, caught within the procedure
"FILL_BMFILE_FROM_BMP"
"(FORM)", or declared in the procedure's RAISING clause.
To prevent the exception, note the following:
You may be able to split the process into separate components, so that
the values generated are smaller.
If the error occurred in one of your own programs or in an SAP program
that you modified, try to correct it yourself.
If you cannot solve the problem yourself, please send the
following documents to SAP:
1. A hard copy print describing the problem.
To obtain this, select the "Print" function on the current screen.
2. A suitable hardcopy prinout of the system log.
To obtain this, call the system log with Transaction SM21
and select the "Print" function to print out the relevant
part.
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, you can either use the "PRINT" command in the editor or
print the programs using the report RSINCL00.
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
System environment
SAP Release.............. "620"
Application server....... "EWR0R3DEV002"
Network address.......... "10.20.32.13"
Operating system......... "SunOS"
Release.................. "5.9"
Hardware type............ "sun4u"
Character length......... 16 Bits
Pointer length........... 64 Bits
Work process number...... 0
Short dump setting....... "full"
Database server.......... "EWR0R3DEV002"
Database type............ "ORACLE"
Database name............ "I07"
Database owner........... "SAPRGG"
Character set............ "C"
SAP kernel............... "640"
Created on............... "Mar 9 2009 21:04:19"
Created in............... "SunOS 5.8 Generic_117350-38 sun4u"
Database version......... "OCI_920 "
Patch level.............. "274"
Patch text............... " "
Supported environment....
Database................. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE
10.2.0.."
SAP database version..... "640"
Operating system......... "SunOS 5.8, SunOS 5.9, SunOS 5.10"
User, transaction...
Client.............. 999
User................ "SREDDY"
Language key........ "E"
Transaction......... "SE78 "
Program............. "SAPLSTXBITMAPS"
Screen.............. "SAPLSTXBITMAPS 4001"
Screen line......... 8
Information on where terminated
The termination occurred in the ABAP program "SAPLSTXBITMAPS" in
"FILL_BMFILE_FROM_BMP".
The main program was "SAPMSSCH ".
The termination occurred in line 1959 of the source code of the (Include)
program "LSTXBITMAPSF03"
of the source code of program "LSTXBITMAPSF03" (when calling the editor 19590).
Processing was terminated because the exception "CX_SY_ARITHMETIC_OVERFLOW"
occurred in the
procedure "FILL_BMFILE_FROM_BMP" "(FORM)" but was not handled locally, not
declared in the
RAISING clause of the procedure.
The procedure is in the program "SAPLSTXBITMAPS ". Its source code starts in
line 1843
of the (Include) program "LSTXBITMAPSF03 ".
Source code extract
019290 endcase.
019300 * compression
019310 perform bmptab_getdword_ofs tables bitmap_file
019320 using ofs bmp_compression.
019330 case bmp_compression.
019340 when c_bmp_compr_rgb. "BI_RGB, uncompressed
019350 when c_bmp_compr_rle8. "BI_RLE8, 256 colors colormap, rle encoding
019360 when c_bmp_compr_rle4. "BI_RLE8, 16 colors colormap, rle encoding
019370 when others. message e872 raising bmperr_unsup_compression.
019380 endcase.
019390 * size of image
019400 perform bmptab_getdword_ofs tables bitmap_file
019410 using ofs bmp_sizeimage.
019420 * pix per meter X
019430 perform bmptab_getlong_ofs tables bitmap_file
019440 using ofs bmp_xpelspermeter.
019450 * pix per meter Y
019460 perform bmptab_getlong_ofs tables bitmap_file
019470 using ofs bmp_ypelspermeter.
019480 * colors used
019490 perform bmptab_getdword_ofs tables bitmap_file
019500 using ofs word.
019510 * colors important
019520 perform bmptab_getdword_ofs tables bitmap_file
019530 using ofs word.
019540 ofs_rgbquad = ofs_bitmapinfoheader + bmp_bisize.
019550 * now we have OFS_RGBQUAD -> color table
019560 * OFS_BITMAPDATA -> bitmap bytes
019570 otf_bminfo-new_rd_format = c_false.
019580 otf_bminfo-is_resident = c_false.
> otf_bminfo-dpi = ( bmp_xpelspermeter * 100 ) / 3937.
019600 perform bmp_adjust_dpi using otf_bminfo-dpi.
019610 otf_bminfo-w_pix = bmp_width.
019620 otf_bminfo-h_pix = abs( bmp_height ).
019630 otf_bminfo-w_tw = ( 1440 * otf_bminfo-w_pix ) / otf_bminfo-dpi.
019640 otf_bminfo-h_tw = ( 1440 * otf_bminfo-h_pix ) / otf_bminfo-dpi.
019650 case bmp_bitcount.
019660 when 1.
019670 otf_bminfo-bitsperpix = 1.
019680 otf_bminfo-bytes_per_row = otf_bminfo-w_pix div 8.
019690 rest = otf_bminfo-w_pix mod 8.
019700 when 4.
019710 otf_bminfo-bitsperpix = 4.
019720 otf_bminfo-bytes_per_row = otf_bminfo-w_pix div 2.
019730 rest = otf_bminfo-w_pix mod 2.
019740 when 8.
019750 otf_bminfo-bitsperpix = 8.
019760 otf_bminfo-bytes_per_row = otf_bminfo-w_pix.
019770 rest = 0.
019780 when 24.
Thanks & Regards,
Srinivas Bhavanam -
How to convert jpeg to bmp using java code
I want to convert a jpeg image to bmp image using java so that any coloured image can be converted to black&white using java. Is there any utility to accomplish this?
Thanks in advanceTry out this category on Esus:
http://www.esus.com/javaindex/j2se/jdk1.2/javaawt/awtgraphics/2dgraphics/images/javaimagetypes/javaimagetypes.html
Cheers,
Joris -
Greetings,
Generous helper can you please help me to convert the SVG file to BMP/JPEG format.
I am using C# as of now , wondering how much feasible to convert SVG to bmp .
Is it possible to do so.
Thanks,Nikkiee,
Options depend of version.
You should be able to open the file in Illy and then export to BMP or JPEG, using Crop Marks (up to 10) or Crop Area (up to CS3) or the Artboard Area Tool in CS4 to set the borders of the image; Help will help you how. You may also state version and get specific instructions here. -
Converting a image file (JPG or BMP or any other) to an Image object
Hello, does anyone have an idea of how I could convert a image file (JPG, BMP, GIF or any other) or even a Corel Draw (.CDR) file to a java Image object?
Thanks in advance
WilsonDemo:
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
public class ImageResized {
public static void main(String[] args) throws IOException {
URL url = new URL("http://today.java.net/jag/bio/JagHeadshot.jpg");
BufferedImage image = ImageIO.read(url);
Icon icon = new ImageIcon(image);
JLabel label = new JLabel(icon);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(label);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
} -
RE: Converting from png to bmp
Hi All
I'm using JAI to convert an image given to me from png to a bmp. However I keep getting
: Error: One factory fails for the operation "encode" and a huge list of areas where various errors have occured. It basically results in an empty bmp being written. Here's the code I'm using:
import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import java.awt.image.RenderedImage;
import java.io.*;
public class PngToBmp
private static void convPng(File theFile)
String name = ((theFile.getName()).replace('.','_'))+".bmp"; //Setting bmp name
RenderedImage pngImage = JAI.create("fileload", theFile.getPath()); //This is reading in the image
RenderedOp op = JAI.create("filestore", pngImage, "C:\\"+name, "BMP"); //This writes the image to the local disk
//This third line of code that is causing the problems - according to the errors produced.
} I also have a main method in the class to call convPng. Any ideas as to what I've done wrong? I looked at the reading in and writing out website for JAI - that's where I constructed this code from. I've clearly not understood something though.
Thanks for any help in advance.As no one replied I finally found the solution. I can't really explain why that code posted above doesn't work I guess it has something to do with the way the png is decoded. Anyway if you want to convert a png to a bmp here's the code to do it:
public static void convPng(String source, String path)
try
OutputStream out = new FileOutputStream(path);
RenderedOp image;
image = JAI.create("fileload", source);
image.getMaxX();
JAI.create("encode", image, out, "bmp", null);
out.close();
catch(IOException err)
System.out.println("!! Read/Encode Error !!");
}The source string is the path of the png and path is where the bmp is to be saved out to. -
Can i convert text file in to a bmp file?
Hi ALL !!!
can i convert test file into a bmp (bitmap)file?please tell me if anybody knows.
thanx in advance,
prabhakarYou're converting a test file (text file?) into a Windows bitmap?
I don't know exactly what that means, but the following links are resources for reading from and writing to a bitmap file in Java, respectively. They may give you an idea on what the bitmap is expecting.
http://www.javaworld.com/javaworld/javatips/jw-javatip43.html?
http://www.javaworld.com/javaworld/javatips/jw-javatip60.html?
Hope they help,
-Troy
Maybe you are looking for
-
Jdev 11g - Error while opening struts-config.xml
Hi, could you help me please, I have this error when I try to open my struts-config.xml file: Message BME-99003: An error occurred, so processing could not continue. Cause The application has tried to de-reference an invalid pointer. This exception s
-
I have pictures in an Olympus RAW format (.ORF I think) from an Olympus 5050 Zoom Camera. I installed the Camedia Master 4.1 software and then went to the Olympus website to download the latest update (4.2). The file downloaded and displayed in the d
-
Dears, Please i need to know what is the difference in the features between Cisco prime infrastructure 1.2 and Cisco prime 1.4. Already i see the release note for each one but the release indicate only the New feature for every one. so i need to know
-
ReferenceError: Error #1056: Cannot create property handler
After updating my lcds application to LCSD 4.6 I get many of these errors. In debug log I can see, that java sends this handler property for some objects, e.g. (com.mm_katalogy.model.MutaceStrankyDTO_$$_javassist_40){id=4} (1675022032) {
-
!!! Forum Problem "Login Delay"
There is a problem with the forum when responding to email digest messages... Responding to any post by clicking the message link in the digest email, then clicking "post..." results in a login screen... however, at least all of this week, immediatel