Jump to content

Extract Colors from Image?


iamnoob

Recommended Posts

I've been using this plugin: http://forums.getpaint.net/index.php?/topic/15318-palette-from-image-tool-20091111/, which works pretty well overall, but I'm wondering if there's an even better way to go about extracting colors from an image.

 

Basically, for example, I have an image of 400+ icons that I wish to extract each -unique- color from and turn it into a palette. What would be the best way to go about doing this?

Link to comment
Share on other sites

I think you're using the right tool. In what way do you want to improve the process? You want to automate it?

If you want to customize the output there is also the CSV file type plugin here http://forums.getpaint.net/index.php?/topic/31674-csv-comma-separated-values-filetype/

Link to comment
Share on other sites

 

Interesting plugin. Not sure how I missed it after checking all of yours.

 

But anyway, if the image I'd like to extract from contains more than 96 unique colors, it would delete the rest or something? Or, I guess it would do this: "If reduced to less than 1000 Colors you can edit the color table." - but I'm not sure exactly what that means.

 

 

I think you're using the right tool. In what way do you want to improve the process? You want to automate it?

If you want to customize the output there is also the CSV file type plugin here http://forums.getpaint.net/index.php?/topic/31674-csv-comma-separated-values-filetype/

 

Well, the main thing is that plugin seems to be sorta buggy. I posted the issues in the thread. And since it's buggy, I can't help but wonder if it's extracting properly. Also, I'm just generally curious what other options are out there for extracting colors from images.

 

What exactly do you mean by "customize the output"? The plugin looks interesting, though. From what I can tell, it will basically save the colors of your image into a text file? So, this is basically extracting each color like I'm asking for? Or am I misunderstanding how it works?

Link to comment
Share on other sites

 

 

But anyway, if the image I'd like to extract from contains more than 96 unique colors, it would delete the rest or something? Or, I guess it would do this: "If reduced to less than 1000 Colors you can edit the color table." - but I'm not sure exactly what that means.

Click on the colortable and you can alter that color

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

What exactly do you mean by "customize the output"? The plugin looks interesting, though. From what I can tell, it will basically save the colors of your image into a text file? So, this is basically extracting each color like I'm asking for? Or am I misunderstanding how it works?

 

You can separate the R, G, B and A channels and arrange them in different sequences, and in different formats.

 

The plugin processes ALL the pixels in the image - saving each one sequentially into a text file.  A note of caution: an 800 x 600 px image is going to generate a file of some size!  It is ideally suited to smaller images.

Link to comment
Share on other sites

Click on the colortable and you can alter that color

 

I see now. Download the plugin and tested.

 

It says my image contains over 2,600 colors, which I don't think is correct. Is it showing only unique colors or duplicates, too? For example, let's say I used this plugin on an image containing three different objects using the same exact yellow... will it show only one yellow - the one being used by all objects - or three yellows, even though it's the same exact shade of yellow?

 

And how does it decide which colors to get rid of when you lower the color count? Does it always keep the most common colors or something?

 

You can separate the R, G, B and A channels and arrange them in different sequences, and in different formats.

 

The plugin processes ALL the pixels in the image - saving each one sequentially into a text file.  A note of caution: an 800 x 600 px image is going to generate a file of some size!  It is ideally suited to smaller images.

 

Not sure what that first line means. Sorry. =/

 

But as far as extracting each pixel - ahhh. 0_0 I definitely don't wanna do that. I only want to extract each unique color being used in my image, not each pixel.

Edited by iamnoob
Link to comment
Share on other sites

With 400+ icons, I would not be surprised if there were in fact 2600 colors. That's only an average of 7 unique colors per icon. Maybe some have gradients or are somewhat anti-aliased, which would increase the color count significantly.

If it were giving you the color of each pixel, then even if we assume the icons are tiny (8x8 pixels), that's 25600 pixels...almost ten times the count you got.

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

With 400+ icons, I would not be surprised if there were in fact 2600 colors. That's only an average of 7 unique colors per icon. Maybe some have gradients or are somewhat anti-aliased, which would increase the color count significantly.

If it were giving you the color of each pixel, then even if we assume the icons are tiny (8x8 pixels), that's 25600 pixels...almost ten times the count you got.

 

I probably should have been more specific about these icons, sorry about that... but they're actually 34x34, pixel art icons. So, a lot of colors are reused(typical pixel art doesn't use many colors) and there is no anti-aliasing.

 

I mean, I could just manually pick out each color with the color picker, but that would take a long time. I'm just hoping there's a simple-ish way for Paint.NET to extract each unique color from the image. Are there 20 unique blues? I want them. 14 unique yellows? I want those. Etc., etc..

Link to comment
Share on other sites

The beauty of the CSV file format is its simplicity. MS Excel opens the format for example. So you could...

1. Compile the 400 icons into one huge image.

2. Use the CSV plugin to save the image data into one CSV file.

3. Open the file in Excel and filter out duplicate colors. Job done!

Link to comment
Share on other sites

The beauty of the CSV file format is its simplicity. MS Excel opens the format for example. So you could...

1. Compile the 400 icons into one huge image.

2. Use the CSV plugin to save the image data into one CSV file.

3. Open the file in Excel and filter out duplicate colors. Job done!

 

But since it saves each pixel and we're talking 400+ 34x34 icons, won't it save 27k+ colors? Wouldn't that be hard to simply delete the duplicates from that huge of a number?

 

Also, I don't think I have MS Excel(is it free and does it come with Windows 7?).

Link to comment
Share on other sites

Wouldn't that be hard to simply delete the duplicates from that huge of a number?

 

Excel, and all the other spreadsheet programs, can automatically remove duplicates for you. It would take seconds.

 

 

Also, I don't think I have MS Excel(is it free and does it come with Windows 7?).

 

No, Excel is not free and does not come with Windows 7. However, you could use LibreOffice Calc to accomplish the task. It is free, in every sense of the word.

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Excel, and all the other spreadsheet programs, can automatically remove duplicates for you. It would take seconds.

 

 

 

No, Excel is not free and does not come with Windows 7. However, you could use LibreOffice Calc to accomplish the task. It is free, in every sense of the word.

 

Hmm. Interesting.

 

But, before possibly having to rely on downloading other programs to accomplish this task, is there not a good way to do it in Paint.NET?

 

Oh, and I just realized there's Google Sheets by Google... would that work?

Edited by iamnoob
Link to comment
Share on other sites

In an attempt to use my Admin powers for Good - I've offered to help iamnoob with this project.

Anyone got any clever ideas on how to assemble 400 smallish images into one large one?

Link to comment
Share on other sites

Anyone got any clever ideas on how to assemble 400 smallish images into one large one?

 

I would point to the evil twin of 'Chop Up and Save' but it is too low on the priority list to publish it.

 

But  TR's PNG Sprite Sheet Matrix may do the trick for pngs.

midoras signature.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...