Git Product home page Git Product logo

Comments (3)

ChunkyPanda03 avatar ChunkyPanda03 commented on August 18, 2024

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

image
https://www.nv5geospatialsoftware.com/docs/write_png.html

from gdl.

GillesDuvert avatar GillesDuvert commented on August 18, 2024

Will need to make some test locally, this is easy to reproduce.

from gdl.

GillesDuvert avatar GillesDuvert commented on August 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.