- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to be able to read a JPG file and convert it
to a bitmap in memory.
Can anyone help please?
to a bitmap in memory.
Can anyone help please?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yo can use FreeimageX, an activex control you can download from freeimage.sf.net.
You must register it with regsvr32.exe and then use the module wizzard to create all the com interfaces avaliable.
The following is a subroutine I use to convert from bmp to png. To convert from jpg to bmp is easy to accomplish, the variable archivo must be of the form "imagen.jpg" and the variable archivo_png as "imagen.bmp". You may ignore the call to $IImage_ChangeColors.
Len
You must register it with regsvr32.exe and then use the module wizzard to create all the com interfaces avaliable.
The following is a subroutine I use to convert from bmp to png. To convert from jpg to bmp is easy to accomplish, the variable archivo must be of the form "imagen.jpg" and the variable archivo_png as "imagen.bmp". You may ignore the call to $IImage_ChangeColors.
subroutine bmp2png( archivo ) use dfcom, only: COMInitialize, COMUnInitialize, COMCreateObjectByProgID use dflib, only: delfilesqq use FreeImage, only: $IImage_Open, $IImage_Save, $IImage_Close, $IImage_ChangeColors implicit none character, intent(in) :: ARCHIVO*(*) character(4096) :: archivo_png integer(4) objeto integer(4) retint integer(2) retsuccess integer(4) status archivo_png=archivo(1:len_trim(archivo)-3) archivo_png=trim(archivo_png)//'png' call cominitialize (status) CALL COMCreateObjectByProgID ('FreeImage.Image', objeto, status) retint = $IImage_Open(objeto, archivo, retsuccess) if(retsuccess == 1) then retint = $IImage_ChangeColors(objeto, int(24), int(1), retsuccess) if(retsuccess /= 0) then retint = $IImage_Save(objeto, archivo_png, retsuccess) retint = $IImage_Close(objeto) if(retsuccess == 1) retint = delfilesqq(archivo) end if end if CALL COMUninitialize () end subroutine bmp2png
Len

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page