Color Quantizing Image Editor
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Color Quantizing Image Editor
This tool is an image editor with special emphasis on various methods of color quantization.
Some of the procedures used in this program are borrowed from this forum.
I would like to give thanks to luis and wilbert for the NeuQuant module,
netmaestro for the ADAPTIVE_PALETTE procedure.
Wilbert for the Count colors, Gaussian blur, and the Sierra Lite dither procedure.
If I am not mistaken the remainder of the code is mine.
Tested on Windows 7 and Linux Mint
version 2.0 | 01/13/2016
Download for Windows
CQ_ImageEditor_2.0_x86.zip
CQ_ImageEditor_2.0_x64.zip
Download for Linux
CQ_ImageEditor_2.0_x64.tar.gz
Download for Mac
CQ_ImageEditor_2.0_x64.zip
older versions
Download CQ_ImageEditor_V1.37
Download CQ_ImageEditor_V1.33
Download CQ_ImageEditor_V1.1
Download CQ_ImageEditor_V1.0
Some of the procedures used in this program are borrowed from this forum.
I would like to give thanks to luis and wilbert for the NeuQuant module,
netmaestro for the ADAPTIVE_PALETTE procedure.
Wilbert for the Count colors, Gaussian blur, and the Sierra Lite dither procedure.
If I am not mistaken the remainder of the code is mine.
Tested on Windows 7 and Linux Mint
version 2.0 | 01/13/2016
Download for Windows
CQ_ImageEditor_2.0_x86.zip
CQ_ImageEditor_2.0_x64.zip
Download for Linux
CQ_ImageEditor_2.0_x64.tar.gz
Download for Mac
CQ_ImageEditor_2.0_x64.zip
older versions
Download CQ_ImageEditor_V1.37
Download CQ_ImageEditor_V1.33
Download CQ_ImageEditor_V1.1
Download CQ_ImageEditor_V1.0
Last edited by BasicallyPure on Fri Jan 15, 2016 5:42 pm, edited 12 times in total.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
Re: Color Quantizing Image Editor
@BasicallyPure,
Very nice! Thank you for sharing.
Also looks nice on my MacBook Pro. Have not found any problems so far.
Very nice! Thank you for sharing.
Also looks nice on my MacBook Pro. Have not found any problems so far.
DE AA EB
Re: Color Quantizing Image Editor
@BasicallyPure,
On the Mac there are a few very minor cosmetic issues with the floating windows, in that some of the text on buttons is truncated.
Even so there is no ambiguity due to aforementioned truncation.
Works really well on the Mac.
Would you consider adding a resize option?
On the Mac there are a few very minor cosmetic issues with the floating windows, in that some of the text on buttons is truncated.
Even so there is no ambiguity due to aforementioned truncation.
Works really well on the Mac.
Would you consider adding a resize option?
DE AA EB
Re: Color Quantizing Image Editor
Nice tool BP !
1) If you start the program and don't load an image but just paste one, the histogram option is not selectable.
2) if the canvas is smaller than the image pasted, maybe you should enlarge the canvas or at least let move the pasted image on the surface of the canvas to let the user decide where to drop it and consequently crop it. Right now it's not clear what's happening, and since moving the mouse has no effect it's not clear you have to right click it to exit paste mode.
I was a little confused initially until I pasted an image smaller than the canvas and I saw what was supposed to happen.
Just what I noticed after testing it for 10 minutes, so maybe there is more
A couple of things I'm missing:
the ability to have a large image to "fit" to the window size (not vital, but that's the norm and it can be handy to have a full view)
a preview (real time best or with a click in the dialog window) while you are changing brightness and contrast, else is just a cycle of trial and error to get the value right, but you can just do these things in an another program after you played with quantization with yours.
BTW: thank you for thanking me even if your work it's in no way based on my original code now probably superseded by the ASM port made by wilbert.
Bye!
1) If you start the program and don't load an image but just paste one, the histogram option is not selectable.
2) if the canvas is smaller than the image pasted, maybe you should enlarge the canvas or at least let move the pasted image on the surface of the canvas to let the user decide where to drop it and consequently crop it. Right now it's not clear what's happening, and since moving the mouse has no effect it's not clear you have to right click it to exit paste mode.
I was a little confused initially until I pasted an image smaller than the canvas and I saw what was supposed to happen.
Just what I noticed after testing it for 10 minutes, so maybe there is more
A couple of things I'm missing:
the ability to have a large image to "fit" to the window size (not vital, but that's the norm and it can be handy to have a full view)
a preview (real time best or with a click in the dialog window) while you are changing brightness and contrast, else is just a cycle of trial and error to get the value right, but you can just do these things in an another program after you played with quantization with yours.
BTW: thank you for thanking me even if your work it's in no way based on my original code now probably superseded by the ASM port made by wilbert.
Bye!
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
Should be fixed in the next version.davido wrote:On the Mac there are a few very minor cosmetic issues with the floating windows, in that some of the text on buttons is truncated.
Yes, it is a possibility in a future version.davido wrote:Would you consider adding a resize option?
Fixed for the next version. There is no longer any need to ever have histogram option disabled.luis wrote:1) If you start the program and don't load an image but just paste one, the histogram option is not selectable.
A workaround can be to first use the 'New Image' option from the popup menu and create a blank image sized large enough to contain the pasted image.luis wrote:2) if the canvas is smaller than the image pasted, ...
I'm going to change the cursor to the 'hand' variation while paste is in progress to give some indication to the user.
I am considering adding various zoom options including zoom to fit.luis wrote:the ability to have a large image to "fit" to the window size (not vital, but that's the norm and it can be handy to have a full view)
The TrackBarGadget really needs a 'mouse up' event to make this work as I would like. Updating the image as the track bar moves along is too muchluis wrote:a preview (real time best or with a click in the dialog window) while you are changing brightness and contrast, ...
computation time for larger images, that is why I chose the 'Apply' button approach. I do have another idea I'm going to try for this so wait and see.
If not for your original code luis, I doubt if wilbert would have ever written the ASM NeuQuant module.
BP
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
Davido,
On the Mac, do the keyboard shortcuts work; (ctrl + C) copy, (ctrl + V) paste, (ctrl + Z) undo, and (ctrl + Y) redo.
I ask because I notice they do not work with Linux. I think I may have uncovered a bug with the Linux version of PureBasic.
I should say they do work with Linux if the caps lock is activated but then the arrow keys no longer function when using a
floating selection.
BP
On the Mac, do the keyboard shortcuts work; (ctrl + C) copy, (ctrl + V) paste, (ctrl + Z) undo, and (ctrl + Y) redo.
I ask because I notice they do not work with Linux. I think I may have uncovered a bug with the Linux version of PureBasic.
I should say they do work with Linux if the caps lock is activated but then the arrow keys no longer function when using a
floating selection.
BP
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
Re: Color Quantizing Image Editor
Unfortunately these keys don't work on the Mac.BasicallyPure wrote:On the Mac, do the keyboard shortcuts work; (ctrl + C) copy, (ctrl + V) paste, (ctrl + Z) undo, and (ctrl + Y) redo.
On the Mac the keys 'Command-c etc. are generally used by programs.
I think the way you deal with rotating text by 90º using the arrow keys is excellent. These keys work on the Mac.
DE AA EB
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
OK davido, thanks for the information.davido wrote:Unfortunately these keys don't work on the Mac.
On the Mac the keys 'Command-c etc. are generally used by programs.
I think the way you deal with rotating text by 90º using the arrow keys is excellent. These keys work on the Mac.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
Re: Color Quantizing Image Editor
Very nice thanks for sharing both the tool and the source
And by the way, i love your signature this is so true and deep
And by the way, i love your signature this is so true and deep
Re: Color Quantizing Image Editor
If you're going to make shortcut keys on Mac, don't use spaces between the "+" sign. For example...
...would be...
Cool app by the way!
Code: Select all
MenuItem( 0, "Copy" + Chr(9) + "Ctrl + C") ;Windows
Code: Select all
MenuItem( 0, "Copy" + Chr(9) + "Cmd+C") ;OS X
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
To any Mac user, Please try this:
Replace the CANVAS_EVENT_HANDLER() procedure with this one.
Then try shortcuts for copy, paste, undo, and redo.
Replace the CANVAS_EVENT_HANDLER() procedure with this one.
Then try shortcuts for copy, paste, undo, and redo.
Code: Select all
Procedure CANVAS_EVENT_HANDLER()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Static keyModifier = #PB_Canvas_Command ; for MAC
CompilerElse
Static keyModifier = #PB_Canvas_Control
CompilerEndIf
Select EventType()
Case #PB_EventType_LeftButtonDown
If GetGadgetAttribute(#Canvas,#PB_Canvas_Modifiers) = keyModifier
ControlKey_Down = #True
EndIf
PostEvent(#CanvasMouseDown)
Case #PB_EventType_LeftButtonUp : PostEvent(#CanvasMouseUP)
Case #PB_EventType_RightClick : PostEvent(#CanvasRightClick)
Case #PB_EventType_KeyUp
If GetGadgetAttribute(#Canvas,#PB_Canvas_Modifiers) = keyModifier
Select GetGadgetAttribute(#Canvas,#PB_Canvas_Key)
Case #PB_Shortcut_C : PostEvent(#CanvasCopy)
Case #PB_Shortcut_V : PostEvent(#CanvasPaste)
Case #PB_Shortcut_Z : PostEvent(#CanvasUndo)
Case #PB_Shortcut_Y : PostEvent(#CanvasRedo)
EndSelect
EndIf
EndSelect
EndProcedure
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
Re: Color Quantizing Image Editor
Hi BP,
Tried you procedure but unfortunately it didn't work - on the Mac.
It looks as if the MacOS doesn't recognise the key modifiers.
It looks as if there might be a bug here. Perhaps another Mac user could confirm or otherwise.
As a work-around I simply removed the If GetGadgetAttribute(#Canvas,#PB_Canvas_Modifiers) = keyModifier and used the keys cvzy.
It didn't interfere with entering text.
Tried you procedure but unfortunately it didn't work - on the Mac.
It looks as if the MacOS doesn't recognise the key modifiers.
It looks as if there might be a bug here. Perhaps another Mac user could confirm or otherwise.
As a work-around I simply removed the If GetGadgetAttribute(#Canvas,#PB_Canvas_Modifiers) = keyModifier and used the keys cvzy.
It didn't interfere with entering text.
DE AA EB
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
Version 1.1 is now available.
See first post for download link.
1. Added resize option for image and canvas.
2. Fixed cosmetic issues.
3. Added option to paste as new image.
4. Histogram is now always available.
5. Keyboard shortcuts should now work on Mac.
6. Added help, press F1 to activate.
7. Rearranged menus and added more shortcuts.
Please report any problems.
thanks,
BP
See first post for download link.
1. Added resize option for image and canvas.
2. Fixed cosmetic issues.
3. Added option to paste as new image.
4. Histogram is now always available.
5. Keyboard shortcuts should now work on Mac.
6. Added help, press F1 to activate.
7. Rearranged menus and added more shortcuts.
Please report any problems.
thanks,
BP
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
- BasicallyPure
- Enthusiast
- Posts: 536
- Joined: Thu Mar 24, 2011 12:40 am
- Location: Iowa, USA
Re: Color Quantizing Image Editor
Version 1.33 is now available.
See first post for download link.
Many code changes in this version.
Some notable changes are:
1. Text can now have transparent background.
2. Black and White and BW dither have been combined as 'Two Color' option.
..... Threshold adjustment added.
..... Any two colors can be selected, not just black and white.
..... 4x4 dither and Sierra Lite dither added as an option
3. Brightness and contrast adjustments now automatically update preview.
4. Updated help document.
5. Automatic window resize when using undo/redo if needed.
6. New GUI color theme.
If anyone knows of a faster way to apply a defined palette to an image please help.
The method I am now using, procedure 'ASSEMBLE_TO_PALETTE()' is a very brute force method and is slow for larger palettes.
It would need to be cross platform.
If anyone has any image editing effects they would like to share I would consider adding them to the editor.
BP.
See first post for download link.
Many code changes in this version.
Some notable changes are:
1. Text can now have transparent background.
2. Black and White and BW dither have been combined as 'Two Color' option.
..... Threshold adjustment added.
..... Any two colors can be selected, not just black and white.
..... 4x4 dither and Sierra Lite dither added as an option
3. Brightness and contrast adjustments now automatically update preview.
4. Updated help document.
5. Automatic window resize when using undo/redo if needed.
6. New GUI color theme.
If anyone knows of a faster way to apply a defined palette to an image please help.
The method I am now using, procedure 'ASSEMBLE_TO_PALETTE()' is a very brute force method and is slow for larger palettes.
It would need to be cross platform.
If anyone has any image editing effects they would like to share I would consider adding them to the editor.
BP.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
Until you know everything you know nothing, all you have is what you believe.
Re: Color Quantizing Image Editor
I think the easiest way would be to extend the NeuQuant module with a procedure that can set a custom palette.BasicallyPure wrote:If anyone knows of a faster way to apply a defined palette to an image please help.
The method I am now using, procedure 'ASSEMBLE_TO_PALETTE()' is a very brute force method and is slow for larger palettes.
It would need to be cross platform.
Once set, you could use the InxBuild and InxSearch procedures from the NeuQuant module after that.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)