Jump to content
How to Install Plugins ×

CSV (comma separated values) Filetype


Ego Eram Reputo

Recommended Posts

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

 

Save_Dialog.png

 

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

 

CSVDemo1.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).

 

Data_Structures.png

 

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.

 

Save_As_Demo.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

Edited by toe_head2001
Fixed broken Postimg images
  • Like 1
  • Upvote 4
Link to comment
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.

Link to comment
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.

midoras signature.gif

Link to comment
Share on other sites

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

Link to comment
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?

Link to comment
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.

midoras signature.gif

Link to comment
Share on other sites

  • 1 year later...

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
Link to comment
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?

Link to comment
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

Link to comment
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

  • Upvote 1
Link to comment
Share on other sites

  • 8 months later...

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

Link to comment
Share on other sites

Rehosted images to remove the toxic Photobleh

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...