Code archives/Graphics/Image Filter Functions
This code has been declared by its author to be Public Domain code.
Download source code
| (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
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
| 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.
Added parameters to most functions
Improved pixel similarity detection
Improved some alogrithms
Added "Washed-Out" filter
Increased Blur effect
Improved pixel similarity detection
seems not all the code made in in the code block :)
| 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!
PencilImage - Approximation of pencil lines
OutlineImage - Approximation of pen & ink drawing
InkImage - Full colour realisation of OutlineImage
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 :)
| I haven't tried your code out yet Malice but it does have an impressive set of features. Well done :) |
| 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:
NormaliseImage: Probably the most useless feature.
MosaicImage: Degrades resolution of image into defined squares
Also included are StampColour, StampPixel, RandomisePixel and RandomiseColour functions.
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.
| Nice work man. I'll probably find these useful! |
| Cheers, Ross - I hope you do. |
| Huge Update.|
New functionality added including:
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
There's more, too :)
| 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?
| Awe! No transparency? :3 |
| 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!
| allowing transparency in a png image |
| 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