New Image plugin available for beta-testing
New Image plugin available for beta-testing
Hi,
It uses the OLE COM API to decode images. According to Microsoft, it should support BMP, ICO, CUR, WMF and EMF files, but it's known to handle GIF and JPEG files as well. I'm not going to argue here about the GIF/LZW issue, I've written some words about that in the help file which comes with the zip, but in short: if OLEAUT32.DLL decodes GIF files, it's not my fault, it comes with Windows, and we all know GIF is an obsolete format, so it's up to you to use this library with GIF files (the library doesn't make any check of the given image file format).
You can download it at:
http://www.terra.es/personal5/temporald ... LE_1.0.zip
Have a look at it and, if you find any bug, please tell me (better not in the bugs forum, but in this same thread).
I have another plugin ready for decoding/encoding PPM files, but I want to release it in a bundle with other image plugins, unless someone is in an urgent need of a PPM plugin, which I doubt.
Other plugins in my TODO list: PBM, PGM, IFF, XPM, XBM, WBMP, TGA encoding, GdiPlus. I have working PB procedures for all of them, so it's only a matter of time to get them translated to Fasm. If you want some format to be included in this list, tell me, and I'll see if I can handle it (the above formats are easy to decode/encode).
Have a nice day,
-- Manolo: estamos con ello, envÃame las contraseñas cuando quieras.
It uses the OLE COM API to decode images. According to Microsoft, it should support BMP, ICO, CUR, WMF and EMF files, but it's known to handle GIF and JPEG files as well. I'm not going to argue here about the GIF/LZW issue, I've written some words about that in the help file which comes with the zip, but in short: if OLEAUT32.DLL decodes GIF files, it's not my fault, it comes with Windows, and we all know GIF is an obsolete format, so it's up to you to use this library with GIF files (the library doesn't make any check of the given image file format).
You can download it at:
http://www.terra.es/personal5/temporald ... LE_1.0.zip
Have a look at it and, if you find any bug, please tell me (better not in the bugs forum, but in this same thread).
I have another plugin ready for decoding/encoding PPM files, but I want to release it in a bundle with other image plugins, unless someone is in an urgent need of a PPM plugin, which I doubt.
Other plugins in my TODO list: PBM, PGM, IFF, XPM, XBM, WBMP, TGA encoding, GdiPlus. I have working PB procedures for all of them, so it's only a matter of time to get them translated to Fasm. If you want some format to be included in this list, tell me, and I'll see if I can handle it (the above formats are easy to decode/encode).
Have a nice day,
-- Manolo: estamos con ello, envÃame las contraseñas cuando quieras.
El_Choni
Sorry for awakening a dead thread, but there seems to be a really nasty bug. Usualy I replaced the PB Decode JPG plugin by the OLE Plugin in order to save few Kb in my EXE, it worked! I was able to load JPG's and the most important: GIF (because no one is able to code a GIF decoder [Guys, GIF patent has gone, and decoding was never patented!]).
Now after expanding my program without changing anything with image loading stuff, I noticed that it is not possible anymore to load JPG and GIF images, except if the PB debuger is running. The faulty JPG decoding can be replaced by sarcifying some Kb and using the PB's own JPG decoder, but I want the GIF!!! It does not load the GIF's anymore and LoadImage() returns a 0. [Panic!].
Now after expanding my program without changing anything with image loading stuff, I noticed that it is not possible anymore to load JPG and GIF images, except if the PB debuger is running. The faulty JPG decoding can be replaced by sarcifying some Kb and using the PB's own JPG decoder, but I want the GIF!!! It does not load the GIF's anymore and LoadImage() returns a 0. [Panic!].
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
I included PNG too, but you're right about the file size. GIF is sometime better., and I cannot affort to not include it. Again sorry for digging in the grave (of both, this thread and GIF), but I have my reasons...
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
-
- Enthusiast
- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
Nonsense. This is not true.Shannara wrote:Heh, not bad. Just remember, currently GIF is the only lossless compression format for images.... so hardly obsoleteWell, you could include "PNG", but the file size is horrendous.
Almost all Image Formats are lossless, except JPG and a few other not to be mentioned.
Some of them have an option, whether to use lossless or lossy compression (like TIFF does). Even the BMP Format is lossless, although it doesn't support compression for 24Bit Images.
As for the Size, YES GIF is very good here, but if you know how to handle PNG you can get results that are nearly as good. Not to speak of Colordepth, here PNG can handle far more than GIF ever was able to.
The only thing GIF is still unbeaten in, is the possibility for small webanimations.
See LoadPictureFile()LCD wrote:Now after expanding my program without changing anything
with image loading stuff, I noticed that it is not possible
anymore to load JPG and GIF images, except if the PB debuger
is running.
If you want to include the Image in the EXE or want to load
it from memory, try CatchPictureFile():
Code: Select all
; Original:
; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=2587&postdays=0&postorder=asc&start=10
; Author: Danilo
; Date : 18. October 2003
; Changed to CatchPictureFile
; Author: Danilo
; Date : 07.01.2004
; Need PB 3.80+ (fixed PB3.80 compiler)!!
Procedure CatchPictureFile(image,adr,dwFileSize)
;
; catch
; BMP, GIF, JPG, WMF, EMF, ICO
;
If adr And dwFileSize
HGLOBAL = GlobalAlloc_(#GMEM_MOVEABLE, dwFileSize)
If HGLOBAL
pvData = GlobalLock_(HGLOBAL)
CopyMemory(adr,pvData,dwFileSize)
GlobalUnlock_(HGLOBAL)
If CreateStreamOnHGlobal_(HGLOBAL, #True, @pstm.IStream) = #S_OK
If OleLoadPicture_(pstm, dwFileSize, #False,?IID_IPicture, @Pic.IPicture) = #S_OK
; Here we got the IPicture Object
Pic\get_Height(@Height)
Pic\get_Width(@Width)
hDC = GetDC_(GetDesktopWindow_())
ScreenPixels_X = GetDeviceCaps_(hDC,#LOGPIXELSX)
ScreenPixels_Y = GetDeviceCaps_(hDC,#LOGPIXELSY)
ReleaseDC_(GetDesktopWindow_(),hDC)
PicHeight = (Height * ScreenPixels_X) / 2540
PicWidth = (Width * ScreenPixels_Y) / 2540
result = CreateImage(image,PicWidth,PicHeight)
If result
hDC = StartDrawing(ImageOutput())
Pic\Render(hDC,0,PicHeight,PicWidth,-PicHeight,0,0,Width,Height,0)
StopDrawing()
EndIf
Pic\Release()
EndIf
pstm\Release()
EndIf
EndIf
EndIf
ProcedureReturn result
DataSection
IID_IPicture:
Data.l $7BF80980
Data.w $BF32,$101A
Data.b $8B,$BB,$00,$AA,$00,$30,$0C,$AB
EndDataSection
EndProcedure
Image = CatchPictureFile(1,?Image_Start,?Image_End-?Image_Start)
If Image
OpenWindow(1,0,0,ImageWidth(),ImageHeight(),#PB_Window_BorderLess|#PB_Window_ScreenCentered,"ImageV!ew")
CreateGadgetList(WindowID())
ImageGadget(1,0,0,ImageWidth(),ImageHeight(),Image)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow : End
Case #WM_RBUTTONUP : End
Case #WM_LBUTTONDOWN : SendMessage_(WindowID(),#WM_NCLBUTTONDOWN, #HTCAPTION,0)
EndSelect
ForEver
EndIf
DataSection
Image_Start:
IncludeBinary "my.bmp"
Image_End:
EndDataSection