Comments (3)
I think that the problem is that the write_png GDL procedure is is not implicitly applying the rgb values when presented a 3d array this is stated in the examples part of the documentation in idl 6.3 however I don't know if it is still valid in later versions I will change the title to better explain the problem.
pro gdlplottingtest
;plotridlv0p5, ydata = lindgen(10), filetype = 'png', output = "C:\Users\beh9172\Documents", filename = 'plot', colorsarr = [255]
thisDevice = !D.Name
Set_Plot, 'Z'
if !version.release eq '6.3' then Device, Set_Resolution=[500,500] else Device, Set_Resolution=[500,500], decomposed = 0, SET_PIXEL_DEPTH = 8
; ; Load drawing colors.
LoadCT, 0
TVLCT, (transpose([0,0,255])), 1
TVLCT, (transpose([255,0,0])), 2
TVLCT, (transpose([255,255,255])), !P.Background
TVLCT, (transpose([0,0,0])), !P.Color
; Draw graphics.
Plot, Indgen(10), Color=1
OPlot, Indgen(10)+1, Color=2
; Add a legend.
;
; Save the image for output to a PNG file.
image = TVRD()
TVLCT, r, g, b, /Get
image24 = BytArr(3, 500, 500)
image24[0,*,*] = r[image]
image24[1,*,*] = g[image]
image24[2,*,*] = b[image]
Write_PNG, 'test.png', image24,r,g,b
write_jpeg, 'test.jpg',image24, quality=100, true = 1
;write_jpg, 'test.jpg', image
Set_Plot, 'win'
device, decomposed = 0
tv, image
Set_Plot, thisDevice
end
https://www.nv5geospatialsoftware.com/docs/write_png.html
from gdl.
Will need to make some test locally, this is easy to reproduce.
from gdl.
@ChunkyPanda03 you do not present a 3D image in your example
image = TVRD()
TVLCT, r, g, b, /Get
Write_PNG, 'test.png', image, r, g, b
a 3D image would have been with image = TVRD(/True) and the WRITE_PNG would have worked.
But indeed, there was a problem in all palette-indexed image writers (write_jpeg, write_bmp...) , especially with PNG where imagemagick does not easily accept indexed images as imput, only 3D images.
#1864 solved this I believe.
from gdl.
Related Issues (20)
- interpol returns float result for complex input data HOT 1
- strings are incompatible with operators and, or, xor etc HOT 16
- GDL will not accept spaces in path to procedure HOT 6
- FOR or FOREACH loop in a EXECUTE() command, itself in a main loop (!) works OK only on SECOND call HOT 1
- Build fails with strict-aliasing violations HOT 6
- sometimes get % SHMMAP: Existing file too short for desired mapping. HOT 6
- Addressing a variable that does not exist causes confusion during a debug session HOT 4
- No Legend procedure HOT 2
- there is no IDL_IDLBridge equivalent HOT 11
- macOS: AppBundle GDL 1.0.6 does not plot HOT 6
- Plotting infinity cause gdl to hang HOT 2
- At least one case where our testsuite is faulty HOT 2
- .out does not go out of procedure if last command before "end" is "return"
- stopped line information is wrong if while loop does not contain a command
- Problem running proceures without pro HOT 4
- GDL 1.04 on Ubuntu 24.04: HDF5 functions not available HOT 7
- silence pointer arithmetic warning issued for !GDL.RELEASE string trim HOT 1
- string and strtrim wrong on ULONG
- `byte_conversion`, `bytscl` and `formats` tests fail on Apple Silicon CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdl.