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

Home » Public Forums » archive » problem with writing a 2D image .tiff
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
problem with writing a 2D image .tiff [message #53502] Wed, 18 April 2007 05:54 Go to previous message
aleks.franca@gmail.co is currently offline  aleks.franca@gmail.co
Messages: 33
Registered: March 2007
Member
Hy
My code reads a 2D tiff image and I create a colortable with 6 levels.
It works fine, and I can visualize the result image, but I'm having a
hard time trying to write the image to my computer.

;Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
image = read_tiff('myImagePath\myImage.tiff'))

device, decompose = 0

colorLevels = [ [0 , 0 , 0 ], $
[0 , 0 , 255], $
[51 , 194, 255], $
[182, 255, 143], $
[255, 200, 0 ], $
[255, 0 , 0 ] ]

numOfLevel = CEIL(!D.TABLE_SIZE/6.)
level = INDGEN(!D.TABLE_SIZE)/numOfLevel

newRed = colorLevels[0, Nivel]
newGreen = colorLevels[1, Nivel]
newBlue = colorLevels[2, Nivel]

TVLCT, newRed, newGreen, newBlue

x = 900
y = 600

;;Visualize result image
image = CONGRID(image, x, y)

WINDOW, 0, xSize = x, ySize = y

TVSCL, image, /order

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


This first part works fine. The problem is below, when I try to write
the result image

;;;;;;;;
;;;;;;;;using write_tif
;;;;;;;;
;;_______TIF
newRed = reform(newRed)
newGreen = reform(newGreen)
newBlue = reform(newBlue)

Write_tiff, 'C:\IDL\tests\mytif.tif', image, $
RED=newred,GREEN=newgreen,BLUE=newblue
;;;;;;;;
;;;;;;;;I've also tried using write_Jpeg
;;;;;;;;
;_______JPEG
array = bytarr(3,x,y)
array[0,*,*] = newred[image]
array[1,*,*] = newgreen[image]
array[2,*,*] = newblue[image]

Write_jpeg, 'C:\IDL\tests\myimage.jpg',array, TRUE = 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;

Does anyone have any idea whats wrong? I'm sure its very easy problem
to treat, but I'm stuck on this problem for 1 week.

Thank you
Aleksander
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: HISTOGRAM and string data
Next Topic: how to force idl to export data in one line?

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

Current Time: Fri Oct 10 10:30:53 PDT 2025

Total time taken to generate the page: 0.64284 seconds