Sign in to follow this  
Followers 0
Ego Eram Reputo

CSV (comma separated values) Filetype

12 posts in this topic

This little filetype plugin is one for all you coders out there ;)

 

It saves the image as a text file containing the pixel RGBA information in numeric format.  Wha...?

 

It takes pixel data, like in this tiny image

 

yhsjjie_6.png

 

and saves it to a text file like this

255179017255,255235015255,215255015255,155255015255,095255015255,035255015255,
255143143255,255192139255,255255139255,192255139255,139255139255,139255192255,
130035255255,236030255255,255030161255,255030049255,255124030255,255236030255,
Numeric formats include decimal, hex (uppercase and lowercase) and binary.

 

The delimiters can be comma, period or space.

 

The pixels data has several formats (RGB, RGBA, BGR, BGRA....,).  If anyone has a specific need of an unsupported sequence let me know and I'll consider it.  The individual color channels can also be separated (the specified delimiter is placed between them).

 

RGB + comma + uppercase hex + line feeds at end of row:

FFB311,FFEB0F,D7FF0F,9BFF0F,5FFF0F,23FF0F,
FF8F8F,FFC08B,FFFF8B,C0FF8B,8BFF8B,8BFFC0,
8223FF,EC1EFF,FF1EA1,FF1E31,FF7C1E,FFEC1E,

BGRA + period + lowercase hex + no line feeds + separate color channels:

11.b3.ff.ff.0f.eb.ff.ff.0f.ff.d7.ff.0f.ff.9b.ff.0f.ff.5f.ff.0f.ff.23.ff.8f.8f.ff.ff.8b.c0.ff.ff.8b.ff.ff.ff.8b.ff.c0.ff.8b.ff.8b.ff.c0.ff.8b.ff.ff.23.82.ff.ff.1e.ec.ff.a1.1e.ff.ff.31.1e.ff.ff.1e.7c.ff.ff.1e.ec.ff.ff.
This plugin will save only.  There is no load.

 

Installation: 

To install the plugin, download my Plugin Pack and unzip it. Run the *.exe installer (written by BoltBait). Restart paint.net.

Usage: The filetype shows up in the Save As... dialog.

 

yhsjjie_7.png

 

I wrote this to extract some custom 256 item palettes from an image which was (you guessed it) 256 pixels high.  I hope you find it useful.

 

Original version dated 23 March 2015 downloaded 217 times

4

Share this post


Link to post
Share on other sites

Nice,  I'll add this to my Hex editing tools.

 

If you don't mind, I'm borrowing your Instructions for my post. :D

0

Share this post


Link to post
Share on other sites

Thanks TR!  Feel free to borrow at will.

 

I've completely FAILED to thank both you and Red Ochre for your help in testing this plugin.   I really do appreciate the assistance.

0

Share this post


Link to post
Share on other sites

Hi EER, you may think about to add

 

        protected override bool IsReflexive(PropertyBasedSaveConfigToken token)
        {
            return true;
        }
 

to avoid that the preview shows 'Computing' forever.

0

Share this post


Link to post
Share on other sites

Great suggestion Midora. I'll add that. Thanks!

0

Share this post


Link to post
Share on other sites

Updated to add Midora's suggestion above.  File size shows the correct file size.

 

@Midora:  Why not add IsReflexive to your filetype template?

0

Share this post


Link to post
Share on other sites

@Midora:  Why not add IsReflexive to your filetype template?

 

You are absolutely right that their should be an update of the PropertyBasedEffect and FileType template. There are still some proposal from Red and you open.

0

Share this post


Link to post
Share on other sites

Any possibility to include all orders of color components, like GRB and others?

Also, include an x component; RGBx; where x is zero? X is the average color on another layer? I guess I could just select RGBA and make sure alpha is set to the level I need before saving.

 

Why you may ask?  NeoPixel buffers for Arduino projects so the image is stored in code.  NeoPixels (or similar one wire bus protocol smart LEDs) come in many different color element patterns, and being able to store a native format is faster to copy to the output buffer.  Further, the newer ones include a W channel that is for a forth White color element on the pixel.

Edited by Makuna
0

Share this post


Link to post
Share on other sites

Any possibility to include all orders of color components, like GRB and others?

Also, include an x component; RGBx; where x is zero? X is the average color on another layer? I guess I could just select RGBA and make sure alpha is set to the level I need before saving.

 

Yes  :D

 

I'm short of time until this weekend, so I'll work on it then.

 

I'll add GRB. Any other channel orders would you like?

 

RE: x I'll add this too - it will be an 8-bit integer you can specify. Which format(s) would you like it for - just RGBx?

0

Share this post


Link to post
Share on other sites

Plugin updated!

 

Added new format types:

 

RGBx

xRGB

BGRx

 

Where the x value is specified using the integer slider.

 

Also added:

 

GRB

 

@Makuna - do you need GRBA and GRBx? (this list could get quite long)

 

Current list of formats:

 

RGB

RGBA

RGBx

ARGB

xRGB

BGR

BGRA

BGRx

GRB

0

Share this post


Link to post
Share on other sites

Updated again in order to add these formats:

 

GRBA

GRBx

 

Current list of formats:

 

RGB

RGBA

RGBx

ARGB

xRGB

BGR

BGRA

BGRx

GRB

GRBA

GRBx

1

Share this post


Link to post
Share on other sites

New format option: Binary Mono

New Delimiter option: None

 

In response to this request: http://forums.getpaint.net/index.php?/topic/110697-how-do-i-export-a-binary-image/

 

Combined, these two options give you a monochrome 1-bit output where white outputs zero and any other color outputs 1. If you want the values the other way around, convert the image to Black and White and invert the colors (Ctrl+Shift+I).

 

CSVBinaryMono.png

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0