ImagePlugin Module (Cross platform multi format de-/encoder)

Share your advanced PureBasic knowledge/code with the community.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ImagePlugin Module (UseWindowsImageDecoder / Encoder)

Post by walbus »

Now, i have more free time and have tested again.
All works for me fine and worry free.
No more problems with broken PNG pictures !
Absolutely simple to use and fast !
Tested with giga pixel pictures, broken PNG's and many other different pictures

Again wilbert, many thanks for this fine work !
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: ImagePlugin Module (UseWindowsImageDecoder / Encoder)

Post by wilbert »

walbus wrote:Tested with giga pixel pictures, broken PNG's and many other different pictures
Thanks for testing :)
Windows (x64)
Raspberry Pi OS (Arm64)
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: ImagePlugin Module (UseWindowsImageDecoder / Encoder)

Post by wilbert »

I uploaded a new version with changed functions names.
It's now UseSystemImageDecoder() / UseSystemImageEncoder()
This allows me to make the module cross platform.
Last edited by wilbert on Mon Sep 05, 2016 7:11 pm, edited 1 time in total.
Windows (x64)
Raspberry Pi OS (Arm64)
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ImagePlugin Module (UseSystemImageDecoder / Encoder)

Post by walbus »

This allows me to make the module cross platform.
Wow !
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by wilbert »

I posted a large update of the module.
It's cross platform now. :)
Please test it and report any problems.
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by djes »

Just great ! Thank you :)
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 544
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by bbanelli »

Works perfectly (incorporated in pretty large project with few hundred PNG icons).
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by walbus »

Full feature test with Windows and Linux.
All works fine, incredible, the best i have see a long time !
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by Keya »

NOTHING SHORT OF BRILLIANT!!! I've been pursuing other options for transparent images for quite a while (its perhaps silly or OCDish of me to feel this way in 2016 but the ~200kb PNG lib often feels to me excessive for my <100kb apps) - native options in Linux and custom raw image format to name just two ... both of which are essentially now redundant by this slick multi-OS native image wrapper!!! :) :) :)
I just wish i had more time at the moment to give it the thorough testing out it deserves but both Decode & Encode demos are working sweet in my old XP-32! will certainly get around to testing it out more properly in due time
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by walbus »

I use this new coders in my QUICK-AES-256 for picture steganographie, just now included, tested and ready all over.

Without problems the old PB coders deactivated and replaced with wilberts GDI+ routines.

For a last stepp i have now replaced the PB Linux Routines , i think in 5 minutes all was ready.

And it works very fine !

The executables are now about 600>700 kb smaller, this are more as 30% !

The new routines are very fast and can loading any pictures without ugly crashes the exe.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by wilbert »

Thanks for the feedback. :)
Good to know it is working on Linux and Window XP as well.
I don't have Windows XP or multiple Linux distros to test with. :wink:
Windows (x64)
Raspberry Pi OS (Arm64)
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by walbus »

This was the "Missing Link" wilbert.

For any users,
You can so test simple the coders :

Code: Select all

UseModule ImagePlugin
UseSystemImageDecoder()
UseSystemImageEncoder()

path$=OpenFileRequester("Load picture", path$, "", 0)
If path$
If LoadImage(1, path$)
  OpenWindow(0, 0, 0, ImageWidth(1), ImageHeight(1), "Image plugin example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(0, 0, 0, ImageWidth(1), ImageHeight(1), ImageID(1))
  Repeat
    Event=WaitWindowEvent()
  Until Event=#PB_Event_CloseWindow
  
  ; Encode as LZW compressed TIFF with 256 colors
 ; *Mem=EncodeImage(1, #SystemImagePlugin, #SystemImagePlugin_TIFF_LZW, 8)
  
  SaveImage(1, "test_tiff.tiff", #SystemImagePlugin, #SystemImagePlugin_TIFF_LZW)
  
  ; Save as jpeg with quality 70
  SaveImage(1, "test_jpg.jpg", #SystemImagePlugin, #SystemImagePlugin_JPEG | 70)
  SaveImage(1, "test_png.png", #SystemImagePlugin, #SystemImagePlugin_PNG)
  SaveImage(1, "test_gif.gif", #SystemImagePlugin, #SystemImagePlugin_GIF)
  SaveImage(1, "test_bmp.bmp", #SystemImagePlugin, #SystemImagePlugin_BMP)
EndIf
EndIf

ModuleImagePluginStop()
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by wilbert »

I posted a small update which improves the decode of transparent images on Mac.
If you are only using Windows or Linux, there's no need to update as nothing has changed for those.
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by J. Baker »

This is very nice. Thanks for making it cross platform! :D

Your code only: 28.5kb executable on XP! :D
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: ImagePlugin Module (Cross platform multi format de-/enco

Post by Keya »

confirmed encoder + decoder both working fine in my Windows XP 32, Windows 7 64, Linux Mint 32, Linux Mint 64, and OSX El Capitan 64. Has anyone been able to test on Windows 10? my W10 VM needs a makeover so i cant test atm
Post Reply