OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:36 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Tue Feb 07, 2017 12:21 am 
Offline

Joined: Sun Sep 02, 2012 7:00 pm
Posts: 10
As other people suggested, it seems you just want an uncompressed array of colors? You could easily write a script to extract the RGB data from an image and save it as a raw bitmap. Here's some incomplete Python code I hacked together using PIL to do this very thing a while ago if it helps https://hastebin.com/vucimudapa.py

Note: This isn't really too salable. I would suggest trying to actually just parse a BMP file or add some information to what ever raw format you want to use that specifies the dimensions of the image.


Top
 Profile  
 
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Fri Feb 10, 2017 1:10 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Love4Boobies wrote:
No, that's what that data structure is called and it can be used for many things, not just images (e.g., this is often what people on this forum use for their first allocators). It's a contiguous map of bits, where each bit (or group of bits) represents an equal part of the whole, in succession.

To my knowledge, Photoshop is the only program which uses this weird "raw" name in the way that you have, which normally suggests something else to anyone familiar with raw data coming from CCD's. However, it's really uncommon and requires elaboration (i.e., "the Photoshop kind") so I suggest avoiding this meaning altogether.

EDIT: See this section on Wikipedia.
dozniak wrote:
+1 to boobies, raw usually means a slightly more complicated image format.
matt11235 wrote:
dozniak wrote:
+1 to boobies, raw usually means a slightly more complicated image format.

RAW is usually the data straight from the sensor of the camera, it requires a lot of processing before you can get something to look at.
Exporting an image that has already been processed as a RAW doesn't really make sense, much like going from a 32kbps mp3 to a 1000kbps FLAC.
As I already said, I am aware of the existence of "raw" files in digital photography. However both Photoshop and GIMP use the term "raw" to refer to raw pixel data (a.k.a. "bitmap" in the "array of bits" sense rather than the ".bmp file" sense) rather than raw camera files.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Fri Feb 10, 2017 1:41 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
onlyonemac wrote:
As I already said, I am aware of the existence of "raw" files in digital photography. However both Photoshop and GIMP use the term "raw" to refer to raw pixel data (a.k.a. "bitmap" in the "array of bits" sense rather than the ".bmp file" sense) rather than raw camera files.
Whoops yes, you're correct. In Photoshop the camera files are referred to as "Adobe Camera Raw" wile the raw pixel data is just "Photoshop Raw". Thanks for clearing that up

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Fri Feb 10, 2017 6:11 pm 
Offline
Member
Member
User avatar

Joined: Wed Jul 13, 2011 7:38 pm
Posts: 558
Photoshop RAW exports 24-bit, unless you have non-opaque pixels, then it can export 32-bit. If you need 32-bit raw bitmaps you could export a 32-bit uncompressed TGA, and rip out the headers and footer.

Or leave in the headers and footer, since TGA is an incredibly simple format that was designed to basically encapsulate packed pixel data that could be blitted to a framebuffer.


Top
 Profile  
 
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Sat Feb 11, 2017 6:18 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
Kazinsal wrote:
Photoshop RAW exports 24-bit, unless you have non-opaque pixels, then it can export 32-bit. If you need 32-bit raw bitmaps you could export a 32-bit uncompressed TGA, and rip out the headers and footer.

Or leave in the headers and footer, since TGA is an incredibly simple format that was designed to basically encapsulate packed pixel data that could be blitted to a framebuffer.
Again this depends if we're trying to do VGA "hello world" or if we're trying to actually parse an image file format. In the former case, trying to parse headers just adds extra room for bugs and makes it harder to figure out where something's going wrong (i.e. "is the problem with copying the data into the framebuffer, or are we actually copying the wrong data in the first place?").

Also, I don't know about Photoshop, but GIMP is able to export as either "standard" (interlaced - with each successive byte giving the red, green, and blue values in turn) format or planar (where all the red values are given first, then all the green values, then all the blue values) format. The latter could be useful for some VGA modes which use a planar framebuffer. There doesn't seem to be an option to save the alpha channel even if the image contains transparent areas (although one could always save it separately by extracting the alpha channel as a greyscale image and combining the resulting raw image files, which would take a bit of work but should be fairly simple for anyone competent in C and/or with experience in processing raw image data).

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Photoshop: Save as array of bytes?
PostPosted: Sat Feb 11, 2017 10:19 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
Is the OP even still reading this thread?

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group