Reusable PureBasic module for loading images through FreeImage.dll and saving the loaded image as PNG or WebP.
Includes a small demo under CompilerIf #PB_Compiler_IsMainFile.
- keep the module small, readable, and fully working
- preserve the stable load/save workflow
- keep the demo useful, but secondary to the module
- core module works
- demo works
- WebP quality and lossless save work
- external dependency is required:
FreeImage.dll
Mod_FreeImage_Wrapper_WebP.pbi= main module and demoREADME.md= project overview and setupTHIRD_PARTY.md= FreeImage dependency and license notes
- Target OS: Windows
- Language: PureBasic
- External dependency:
FreeImage.dll - Offline local tool / module
- No installer required
- Demo expects
FreeImage.dllin the working directory or next to the executable
- module-based PureBasic code
- practical structure over abstraction
- single-file module with built-in demo
- readable event handling
- minimal public API
- avoid unnecessary extra files
- use
EnableExplicit - preserve
DeclareModule/Modulestructure - keep module interface clean
- use
Sharedconsistently for module-level structures/vars in procedures - keep functions focused
- avoid duplicate helper logic
- remove unused constants, variables, and declared procedures when safe
- do not add speculative abstractions
- the reusable code is the module
- the demo block is only an example and test UI
- the demo must not define the module architecture
- module state is held in shared structures
- loaded image state and FreeImage API state are persistent inside the module
- code under
CompilerIf #PB_Compiler_IsMainFileis demo/test code only - demo changes must not break the reusable module API
- module improvements should be implemented in the module first, not only in the demo
FreeImage.dllis an external dependency- do not bundle third-party binaries into the repository unless explicitly requested
- document dependency usage clearly in README and THIRD_PARTY
- do not replace FreeImage with another dependency unless explicitly requested
- isolate the failing step first
- use short targeted debug output
- prefer minimal fixes over rewrites
- remove temporary debug traces after the fix unless still useful for the demo
- keep error messages concrete
- keep README short and scannable
- keep THIRD_PARTY.md factual and transparent
- public module releases should include a small working demo
- document external dependency setup clearly
- do not repeat the same information across README and THIRD_PARTY more than necessary
- keep public releases focused
- release only working code
- include README and third-party notice
- do not publish unfinished refactors as stable versions
- keep the public API stable unless a change is explicitly intended
- prefer minimal changes
- preserve working behavior
- avoid broad rewrites
- do not reformat unrelated code during functional edits
- keep the module usable as a drop-in example
-
ALWAYS treat the module as the primary code and the demo as secondary example code.
-
ALWAYS preserve existing project style unless a change is explicitly requested.
-
ALWAYS prefer the smallest correct change over a broad rewrite.
-
ALWAYS verify whether the requested feature already partially exists.
-
DO NOT refactor stable working logic unless explicitly asked.
-
DO NOT move core module logic into the demo block.
-
DO NOT treat the demo block as the reusable API.
-
DO NOT add new dependencies unless clearly necessary.
-
DO NOT silently change file formats, naming conventions, or save behavior.
-
CHECK for existing constants before hardcoding values.
-
CHECK for
Sharedaccess to module-level structures/variables inside procedures. -
CHECK for unused defined variables and unused declared procedures before finalizing changes.
- unnecessary rewrites
- duplicate helper functions
- over-abstracted architecture
- demo-only fixes that ignore the module
- undocumented dependency changes
- dead code left behind