How can I determine the colorspace (RGB) profile of my data? - rgb

I have a standard jpeg image, which I use within some commercial software to colorize other data (by mapping the image's color onto the data). Then I export the colored data from this software to an XYRGB ascii file, i.e. I store the data information in the first two columns of each row and then the three RGB colors in the last three columns.
Since I need to convert the color to CIELab or CIELuv, it seems I need to know which exact colorspace (RGB, sRGB, gamma, whitepoint - you name it) my RGB values are in. But the question is: How can I find out? Or could I just assume a certain profile being a good approximation?
(Remark: The company of the commercial software I used was not able to tell me any specifics...)

If you don't know the provenance of the image, there's not anything you can do to determine the color space from the RGB data alone. It's a little like having a blueprint without a scale. You could guess and check with an application like Photoshop that can assign a profile to an image but even then it's not always obvious which is correct unless the image contains colors you can recognize as correct.
For many images sRGB is good guess. Most image on the web are sRGB and many non-color managed apps assume sRGB. But just understand that it is still a guess. If color accuracy is critical, you need the profile.

Related

Get WPF single path data from . png file

I would like to convert png file(transparent icon) to WPF "path data".
Any idea how to get single wpf path data from .png icon.?
There is no direct way to do it. A PNG file is a raster format (i.e. it stores the colour of each pixel in the image). WPF Path Data is a vector format (i.e. it stores the image as geometric drawing instructions). If you are unsure what this means, see here for more info.
Vector can be converted to raster (at a set size), but raster cannot be obviously converted to vector (which is what you want).
The only way to try and convert raster to vector, with varying results, is to "trace" the raster image to guess what the equivalent geometric vector instructions might possibly be. The ability to trace a raster image accurately is directly proportional to its pixel dimensions and complexity of graphics. So tracing a [presumably] small icon might not be possible at all.
If I were faced with your problem, I would get as high a quality PNG image as possible, import it into Adobe Illustrator, use the Illustrator tracing tools to trace the image, and finally export the result of the trace to XAML (using something like http://www.mikeswanson.com/xamlexport/).
If you are looking for runtime tracing, this is something I have not come across. Given the massively varying tracing parameters which are required for different styles of raster images, I don't suppose it would even be realistically possible.
Good luck.

clarifying gamma topic (in general)

I understand gamma topic but maybe not 100% and
want to ask somebody to answer and clarify my
doubts.
As I understand
there is a natural linear color space where color
with value 100 is exactly four times brighter then color
with value 25 and so on (it would be good to hold and
process color images in that format/space
when you will copy such linear light image onto
device you would get wrong colors becouse generally
some medium values would appear to dark sou you
generally need to rise up this middle values by something
like x <- power(x, 1/2.2) (or something)
this is reasonably clear, but now
are the normal everyday bitmap or jotpeg images
gamma precomputed ? If they are when i would do
some things al blending and so should i do some
inverted-gamma to boath them to convert them to
linear then add them and then gamma-correct them
to result?
when out of scope would apperr it is better co cut
colors or resacle it linearly into more wide range or
something else?
tnx for answers
There's nothing "natural" about linear color values. Your own eyes respond to brightness logarithmically, and the phosphors in televisions and monitors respond exponentially.
GIF and JPEG files do not specify a gamma value (JPEG can with extra EXIF data), so it's anybody's guess what their color values really mean. PNG does, but most people ignore it or get it wrong, so they can't be trusted either. If you're displaying images from a file, you'll just have to guess or experiment. A reasonable guess is to use 2.2 unless you know the file came from an Apple device, in which case use 1.0 (Apple devices are generally linear).
If you need to store images accurately, Use JPEG from a camera with good EXIF data embedded for photos, and maybe something like TIFF for uncompressed images. And use high-quality software that understands these things. Unfortunately, that's pretty rare and/or expensive.

Displaying a user-customized part on a web site

I'm building a web site (asp.net) for a company that manufactures small customizable anodized aluminum products. Products are a variety of shapes. but mostly flat, domed or ring-shaped. Products can be colored in one of about 15 colors.
The user can specify one or more lines of text and a font, a simple line drawing (e.g., a heart or four-leafed clover), or both. Text is limited to about 5-15 characters per line. The text or drawing is milled into the part and can be colored in a contrasting color.
What I want to do is display the customized product to the user, so that after selecting product, colors, text,, font and artwork the site will display an image of how the finished product will look. Ideally they would be able to rotate the image but that's not critical.
I have digital descriptions (CAD and CNC milling instructions) of all the parts, fonts, and artwork and can translate them into whatever format is needed.
Can this be done with Flash, SilverLight, or some similar technology? Ideas, references, suggestions, and tutorials welcome! Thanks
It can be done in Flash, but it requires a lot of work:
To get a realistic version of the product displayed, you have to produce pictures, videos and whatever other depictions of all possible shapes and colors of your product, then you simply have to switch between those depending on the user's choice.
Adding the writing is a bit trickier when the surface isn't flat, but you can model a dome or ring-shaped surface with 3D polygons and add the text as an image texture.
It is best to have a set of standard views, maybe 4 or 5 angles, so that you only have to figure each position out once for each similar shape, and afterwards you can just copy the positioning etc.

Generating a readable colour from RGB?

I'm putting in a function which will allow a user to input a color (eg: purple) and it will change the look of their profile to be purple. It's interpreted from text into a 'Color' class which stores them inside itself as RGB numbers (int for red, one for green and other for blue). What i don't know how to do is logically turn these three numbers into another 3 which will make a readable colour.
Can anyone help me on how to do this?
Joe
If I'm interpreting your question correctly, you're looking for a readable text color after someone has chosen a background theme color. This was answered in an older question:
Good text foreground color for a given background color
Obviously, there's not a name for every possible RGB combination! Presumably you want to find a nearby combination that you have specified a name for?
So really all you need is a way of defining how "close" one RGB is to another. For simplicity, I would suggest Euclidean-distance-squared, i.e. (R2-R1)^2 + (G2-G1)^2 + (B2-B1)^2. Then all you need to do is iterate through all your "named" colours, and find the one with the smallest distance.
You could look at the rgb.txt file that comes with X11.
A parser for that could provide a translation between those strings and the RGB values wouldn't be terribly hard to build and would likely do what you're looking for.
As others already say, there are 16.7 million possible combinations, all of which obviously can't have a defined name.
You're not going into detail about your use case, but if you want to make it end user friendly, how about using percentages?
80% red, 50% green, 23% blue
this is perfectly understandable for a non-technical person as well. You would limit (from 256^3 to 100^3) the number of possibilities if you use integer percentage values, but not as much as confining the user to a fixed palette of named colours.

Store large image

I'm looking for a way to store a very large image (e.g. 100.000x100.000 pixels) on a webserver. I must be able to retrieve parts of that image and write parts into it. The cherry on top would be a way to get parts of that image, resized to a specific resolution (for example, i want alle pixels from 0,0 to 10.000,10.000 resized to 1000x1000 pixels).
Anybody know a kind of DB, or a data-structure or any other way or service or programm that can handle something like that?
thx, tux
How about Tiles?
Just like what popular mapping application (Google Maps / Bing Maps ) does. Divide and pre-process your image in to tiles for various sizes (zoom levels). Display them on a webpage with zero margin, zero border.
While retrieving, calculate positioning of tiles (which tiles should be retrieved as whole and which ones as partial) and then return as single image.
http://143.117.54.5/idl/images/img_pyrm.gif
(image ack: http://143.117.54.5/idl/Image_Tiling.html)
Search for "map servers": there are a bunch of them already available. I'm sure they at least contain components that might be of interest for you.

Resources