comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Jpeg in a .sav file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Jpeg in a .sav file [message #59245 is a reply to message #59244] Thu, 13 March 2008 13:37 Go to previous messageGo to previous message
mmiller3 is currently offline  mmiller3
Messages: 81
Registered: January 2002
Member
>>>> > "Rick" == Rick Towler <rick.towler@nomail.noaa.gov> writes:

> The trick is encoding the image into a function. Like so:

> http://www.acoustics.washington.edu/~towler/programs/make_im ageFunction.pro

Nice one Rick - I've done a similar thing for widget bitmaps.
Probably it was originally based on something I saw from you or
someone else on this newsgroup, but I was bad and did not comment
my code.

Mike



pro bmp_to_function, bmp_file, function_name
print, 'reading bitmap from ', bmp_file

test = query_bmp(bmp_file, info)
case info.channels of
3: begin
;; 3 channel bit map, so use it as is...
bmp = read_bmp(bmp_file)
result = bytarr(info.dimensions[0], info.dimensions[0], 3)
result[*,*,0] = bmp[0,*,*]
result[*,*,1] = bmp[1,*,*]
result[*,*,2] = bmp[2,*,*]
end
1: begin
;; single channel bit map ==> use RGB colors
bmp = read_bmp(bmp_file, R, G, B)
result = [[[R[bmp]]], [[G[bmp]]], [[B[bmp]]]]
end
endcase

print, 'writing function ', function_name, ' to ', function_name+'.pro'
openw, lun, function_name+'.pro', /get_lun
printf, lun, 'function ' + function_name
printf, lun, 'bmp = bytarr(' + strtrim(info.dimensions[0],2) + ',' + strtrim(info.dimensions[1],2) + ',3)'
for x = 0, info.dimensions[0]-1 do begin
for y = 0, info.dimensions[1]-1 do begin
for c = 0, 2 do begin
printf, lun, 'bmp[' + strtrim(x,2) + ','+ strtrim(y,2) + ','+ strtrim(c,2) + '] = ' + strtrim(fix(result[x,y,c]),2)
endfor
endfor
endfor
printf, lun, 'return, bmp'
printf, lun, 'end'
free_lun, lun

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: unsigned long long and min/max operator
Next Topic: Re: WindowsXP IDLWorkbench hang issue

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:33:55 PDT 2025

Total time taken to generate the page: 0.56395 seconds