forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Writing an Image In HEXADECIMAL Format

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Apr 21, 2014 8:10 pm    Post subject: Writing an Image In HEXADECIMAL Format Reply with quote

1. Is it possible to output from CLEARWIN+ an image in HEXADECIMAL format (readable ASCII not binary) ?
2. Is .PDF output possible from CLEARWIN (I can't find any mention of it in the manual) ?
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Apr 21, 2014 8:34 pm    Post subject: Reply with quote

I don't understand 1.

As far as 2. goes, you could try the PSPLOT routines (http://www.nova.edu/ocean/psplot/) OR use Clearwin+ graphics output to a PostScript printer driver, then use Adobe Acrobat. (There are PDF printer drivers that don't need Acrobat - I found 10, including some free ones - on the web).

OR write any sort of graphics file that you can import into MS Word, then save as a PDF (free!).

E
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Apr 21, 2014 9:37 pm    Post subject: Reply with quote

For item 1 you could try %rd[radix=16]. The control can be made read-only if you wish %`rd[radix=16].
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Tue Apr 22, 2014 10:13 am    Post subject: Reply with quote

Paul, It's an image not a value, so it must be a series of bytes, and images are written like that anyway.

If you want to read the data in an image in hexadecimal it isn't a function of how you write it, it's a function of how you read it - you need an editor that displays hex. It's so long ago that I used one I even forgot what it was called, let alone how to use it!

Eddie
Back to top
View user's profile Send private message
brucebowler
Guest





PostPosted: Tue Apr 22, 2014 2:31 pm    Post subject: Reply with quote

I'll start by saying I've got no idea if this will work since I'm not a clearwin person, but if I wanted to write something to a file in hex format, I'd use the Z format descriptor which writes integers as hex.
Back to top
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Apr 22, 2014 2:54 pm    Post subject: Reply with quote

My first question was confusing because I mentioned ASCII alongside HEXADECIMAL.
What I'd like is simply to WRITE an image (e.g. the contents of a Graphic window bitmap) represented in HEXADECIMAL characters simply written to a 'readable' characters i.e. not BINARY) file.
This can be read in Notepad, or Wordpad for example Eddie.
(I have a feeling that's still not clear)
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Apr 22, 2014 3:11 pm    Post subject: Reply with quote

Regarding Point 2. Eddie, I was asking about the possibilities
for .PDF output ! not PostScript ! Although the link you provided is interesting too, even though it's applicable to off-screen plotting it could come in useful. Thanks.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Tue Apr 22, 2014 6:14 pm    Post subject: Reply with quote

Still on pt. 1 - like this http://www.engineersgarage.com/tutorials/what-is-hex-file-format
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Mon Apr 28, 2014 12:18 pm    Post subject: Reply with quote

I think a (at least partial solution) may be to use GET_DIB_BLOCK which outputs any desired 'area' of an image (bmp) into a CHARACTER array, PARRAY, so are presumeably HEXADEDIMAL values ? (if not they could be easily converted). The values stored being the RGB colours of each pixel.
The header can presumeably be constructed separately using info. from GET_DIB_SIZE parameters. I shall have to investigate more the actual .bmp/.jpg format to see exactly what info would be needed for the full header.
Back to top
View user's profile Send private message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Wed Apr 30, 2014 11:16 am    Post subject: Reply with quote

Could you give us some more information about your application and the purpose of dumping bitmap as hex?

If you just need to extract some specific bitmap information, then getting the data directly from the WIN32 BITMAP structures is probably the preferred approach.

If you want to create a straight hex dump of the bitmap file, then brucebowler's earlier suggestion is probably the way to go.

LitusSaxonicum wrote:
If you want to read the data in an image in hexadecimal it isn't a function of how you write it, it's a function of how you read it - you need an editor that displays hex. It's so long ago that I used one I even forgot what it was called, let alone how to use it!

No problem, you can use my hexdump utility. Very Happy It's written in a hurry with just few lines of code, so it's not too flashy. PL/I source is included inside the package.

Example output from the start of some bmp-file:
Code:

00000000: 42 4D 36 C1 00 00 00 00  00 00 36 00 00 00 28 00 | BM6.......6...(.
00000010: 00 00 01 01 00 00 40 00  00 00 01 00 18 00 00 00 | ......@.........
00000020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | ................
00000030: 00 00 00 00 00 00 FF FF  FF FF FF FF FF FF FF FF | ................
00000040: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000050: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000060: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000070: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000080: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000090: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000A0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000B0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000C0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000D0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000E0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
000000F0: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000100: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000110: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000120: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000130: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000140: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ................
00000150: FF FF FF FF FF FF FF FF  FF E4 E4 E4 B3 B3 B3 A5 | ................
...
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Apr 30, 2014 12:41 pm    Post subject: Reply with quote

Plato can display files in binary form. Just click Open on the File menu and use the appropriate check box.
Back to top
View user's profile Send private message AIM Address
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Wed Apr 30, 2014 3:59 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
Plato can display files in binary form. Just click Open on the File menu and use the appropriate check box.

I had missed that option. It is not available, if you use toolbar button instead of a menuitem for opening file.

I have mapped my hexdump utility as a Plato command and it works quite nicely.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group