Home
Products
Community
Manuals
Contact
Login or Signup

Code archives/Graphics/Image Filter Functions

This code has been declared by its author to be Public Domain code.

Download source code

Image Filter Functions by _PJ_(Posted 1+ years ago)
(UPDATE 9th March 2012)

These functions can be used to process 2D images in various ways.
With the exception of the ScrollImage function, each method creates and returns a new image so the original is unaffected.
I've tweaked the algorithms as much as I believe is necessary to give acceptable results, however, you may wish to try different parameters where applicable and the source image colour range etc. has a large impact.

Where possible, alpha channels are preserved.

___________________________________________________________


See later post for the Demonstration Program. This example program demonstrates many available features. To use, change the line
Const ImagePath$="TEST.bmp"

To a filepath of the desired image.

Images with dimensions greater than 2048 may crash the program. This is a DX7 limitation.

The code posted in this first section contains ONLY the functions. For the example program, see later post!
; Sorry  

; Despite the 'No Links' requirement of the Code Archives
; the limitations on the code-box here truncate the function
; code leaving it incomplete.

; Therefore, please check HERE: 
; This is a Link to my Worklog so should be trustworthy
; and available for all Blitz users.

; http://www.blitzbasic.com/logs/userlog.php?user=2370&log=1849

Comments

_PJ_(Posted 1+ years ago)
Here's the Example program.
Note the "include" line at the top. This should be used to include the function code in the first post.




_PJ_(Posted 1+ years ago)
Updated:

Added parameters to most functions
Improved pixel similarity detection
Improved some alogrithms
Added "Washed-Out" filter


_PJ_(Posted 1+ years ago)
Updated

Increased Blur effect
Improved pixel similarity detection
Improved emboss


RifRaf(Posted 1+ years ago)
nice,

seems not all the code made in in the code block :)


_PJ_(Posted 1+ years ago)
Wow, sorry RifRaf, I didn't notice that!

I'l figure something out here and re-post. Likely removing a lot of the commented-out-separator lines might help!
The last few functions are actually based on some 'borrowed' from jfk's entry: http://www.blitzbasic.com/codearcs/codearcs.php?code=1380

So look there if you really need them! :)

____________________________________________
_______________________________________



Edit sorted. Please see post below!


_PJ_(Posted 1+ years ago)
Added:
PencilImage - Approximation of pencil lines
OutlineImage - Approximation of pen & ink drawing
InkImage - Full colour realisation of OutlineImage

Fixed:
Removed some Whitespace and Comment lines preventing full function text to be displayed.

(I should be adding more functionality soon.
Extra functions will be added in separate posats below due to limited space above :)


MCP(Posted 1+ years ago)
I haven't tried your code out yet Malice but it does have an impressive set of features. Well done :)


_PJ_(Posted 1+ years ago)
Thank you, MCP
I'm not sure how much of them will really be particularly useful, unless in some drawing app, or perhaps making some loading-screen variant of a buffer capture ???

Some More addiitons/fixes:

Added:
=======================================================
NormaliseImage: Probably the most useless feature.
MosaicImage: Degrades resolution of image into defined squares

Also included are StampColour, StampPixel, RandomisePixel and RandomiseColour functions.


Fixed:
=======================================================
General cleanup and efficiency improvements.
If tolerance=100% or intensities are 0, a handle for a copy of the original instead of the original itslef's handle is now passed back.
Some minor bug fixes where few individual colour effects were ignored.
Some minor bugfixes relating to Definition checking
Blending pixel saturation fixed. No longer wraps-around
Emboss: Incorporates multiple passes for less degradation
InkImage: No longer restricted to basic colours
CharcoalImage: Should now be more accurate.
CrayonImage: Now has Greater colour definition, but a grainier finish.
PencilImage: Smoother definition.
WashoutImage: Fixed incorrect colouration.


Ross C(Posted 1+ years ago)
Nice work man. I'll probably find these useful!


_PJ_(Posted 1+ years ago)
Cheers, Ross - I hope you do.


_PJ_(Posted 1+ years ago)
Huge Update.

New functionality added including:

AgeImage
EdgeImage
CropImage
False-Lighting
NightVision filter

Fixes and Improvements including:

Oultine detection improved
Inking Colour resolution improved
Contour Algorithm efficienvcy
Charcoal & Chalk Dithering improvements
Brighten/Darken now operates correctly according to relative pixel brightness
Pencil strokelines

There's more, too :)


Krischan(Posted 1+ years ago)
Hmm looks like the code is broken as it could be too large for the code archive? It suddenly ends in the function "ColourContourCheck%":



Could you please split it up or post a Download link for the functions file?


Thundros(Posted 1+ years ago)
Awe! No transparency? :3


_PJ_(Posted 1+ years ago)
Krishcan - Sorry - the restrictions on post-size truncated the code. Check now, and oyou should see a link to my worklog which contains the code.

The code for these Filter Effects is STILL Public Domain as far as I am concerned :)

Thundros - For the most part, alpha channels are preserved, what in particular were ytou referring to? It may be something I can add in!


Thundros(Posted 1+ years ago)
allowing transparency in a png image


_PJ_(Posted 1+ years ago)
PNG images contain alpha channels by default. There's nothing 'Dissallowing' them either in the code posted here or within Blitz itself.
Can you be more specific at all???


Code Archives Forum