Opened 10 years ago

Closed 2 years ago

#822 closed enhancement (worksforme)

enhance "Save display to graphic file" in wxGUI

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.4.0
Component: wxGUI Version: svn-trunk
Keywords: d.out.file, save image, map display Cc:
CPU: All Platform: All

Description

In wxGUI, the "Save display to graphic file" is yet rather limited with respect to what gis.m provided (disk symbol).

Idea: Since d.out.file already generates wxpython code, it could be recycled in the GUI.

Glynn mentioned on the list: d.out.file requires a monitor from which to obtain the list of displayed maps (i.e. d.save). It doesn't have to be an X monitor.

Obviously, the GUI has this information somewhere.

Actually, it has the code as well; see Layer.Render and Map.Render in render.py.

Change History (18)

comment:1 Changed 10 years ago by cmbarton

I quit using d.out.file when the interface dropped the xmonitors for a TclTk? canvas. So I haven't followed subsequent updates to the script. What additional functionality does it have beyond setting resolution?

Michael

comment:2 Changed 10 years ago by neteler

The d.out.file stuff was only an idea. The point of the enhancement request is an equivalent of this code chunk in maptool.tcl to be added to the wxGUI:

        # menu for saving display
        set savefile [menu $mapsave.sf -type normal]
        set jpgfile [menu $savefile.jpg -type normal]

        $savefile add command -label "BMP*" -command {MapToolBar::savefile bmp 0}
        $savefile add cascade -label "JPG*" -menu $jpgfile
                $jpgfile add command -label [G_msg "low quality (50)"]  \
                        -command {MapToolBar::savefile jpg 50}
                $jpgfile add command -label [G_msg "mid quality (75)"] \
                        -command {MapToolBar::savefile jpg 75}
                $jpgfile add command -label [G_msg "high quality (95)"] \
                        -command {MapToolBar::savefile jpg 95}
                $jpgfile add command -label [G_msg "very high resolution (300% your current resolution)"] \
                        -command {MapToolBar::savefile jpg 300}
        $savefile add command -label "PPM/PNM" -command {MapToolBar::savefile ppm 0}
        $savefile add command -label "PNG" -command {MapToolBar::savefile png 0}
        $savefile add command -label "TIF*" -command {MapToolBar::savefile tif 0}
        $savefile add command -label [G_msg "(* requires gdal)"] -state disabled

Markus

comment:3 Changed 10 years ago by cmbarton

The formats to which saving is permitted is determined by the canvas software (wxPython in this case). It looks like we can easily save to: bmp, pcx, pnm, and xpm; jpg doesn't work. At least this is what is usable on my Mac. Do you want this added to 6.4, 6.5, or 7?

Michael

comment:4 in reply to:  3 Changed 10 years ago by glynn

Replying to cmbarton:

The formats to which saving is permitted is determined by the canvas software (wxPython in this case).

Or you can convert the PPM/PGM files (from g.pnmcomp) which are displayed in the canvas using an external package such as ImageMagick or NetPBM. Or you can make PIL (Python Imaging Library) an optional dependency and use that.

But it would be better to re-run the layer commands within an appropriate environment. This would allow you to use the cairo driver for PostScript, PDF or SVG output (or the PS driver for PostScript output), rather than being limited to bitmap formats.

comment:5 Changed 10 years ago by cmbarton

Except that I can't develop this yet since no one has yet worked out how to get Cairo for Mac working with GRASS.

Adding more output formats is easy at the moment, although it doesn't offer the kind of quality that you're talking about. This is also something to consider for a cartography module for the GUI.

Michael

comment:6 Changed 10 years ago by hamish

see also #977

comment:7 Changed 9 years ago by neteler

In the gis.m is a functionality "Constrain map to region geometry" which would help to match computational region and display region in order to produce the correct world file.

comment:8 Changed 6 years ago by wenzeslaus

Keywords: d.out.file save image map display added

neteler, cmbarton and hamish, how current functionality and G7:d.out.file (r59010 and r59011, announced in d.out.file at grass-dev) influences your requests here? Can you rephrase requirements? (I really don't know what gis.m (disk symbol) is.)

Apparently, the implementation is not the one suggested by glynn in comment:4. And #977 is not implemented either.

By the way, who likes the word "graphic" in "Save display to graphic file"?

comment:9 in reply to:  8 ; Changed 6 years ago by neteler

Replying to wenzeslaus:

By the way, who likes the word "graphic" in "Save display to graphic file"?

The word "graphic" is very confusing, better to be changed.

comment:10 in reply to:  9 ; Changed 6 years ago by annakrat

Replying to neteler:

Replying to wenzeslaus:

By the way, who likes the word "graphic" in "Save display to graphic file"?

The word "graphic" is very confusing, better to be changed.

done in r59203

comment:11 in reply to:  10 ; Changed 6 years ago by martinl

Replying to annakrat:

The word "graphic" is very confusing, better to be changed.

done in r59203

Probably "Save display content to image file" would be more informative?

comment:12 in reply to:  11 Changed 6 years ago by wenzeslaus

Replying to martinl:

Replying to annakrat:

The word "graphic" is very confusing, better to be changed.

done in r59203

Probably "Save display content to image file" would be more informative?

The one point is that is should be short.

The other is that it should be easy to understand. "image file" is the same as "graphic file" it does not add any information, to which kind of file would I want to save an image and what is that image file anyway, .img? So, to where is clear "file". Alternatively we can leave out the whole to part. So, we would get "Save display" (my browser also says only "Save page", it is clear that it will be file or files on the disk).

What to save is more difficult. It is "display", "display content", "displayed image", "image", "map"? I'm not sure but one word should be enough. Current "display" is pretty common word in GRASS describes everything related to displaying maps, so it is OK here I would say. On the other hand "display" is strange for everybody else.

"Save image" could be enough?

comment:13 Changed 6 years ago by cmbarton

'Save display' or 'save window' is better, at least in English.

'Save image' could be confusing (what image?) and possibly misleading (save the GIS/image file?). What is being done is that what you see in the display window (technically a graphic canvas) is being written to a graphic format file of your choice.

In GRASS, most of what goes on is not a display. You can display selected maps in a window (graphic canvas), of course. Also, this function is called from a button on the top of that display window. so I don't think that display is overly generic or confusing in this context. 'Save Display' is probably the most accurate and descriptive with the fewest words.

comment:14 Changed 4 years ago by wenzeslaus

Any ideas here? Should we close it? The current text says Save display to file.

Another thing we should take into consideration is what will be the text for "d.save button" in case we will introduce it back.

There is G7:d.out.file and G7:d.to.rast, so I think the original ticket is solved.

comment:15 Changed 4 years ago by martinl

Milestone: 7.0.07.0.5

comment:16 Changed 4 years ago by martinl

Milestone: 7.0.57.3.0

comment:17 Changed 4 years ago by martinl

Milestone: 7.3.07.4.0

Milestone renamed

comment:18 Changed 2 years ago by martinl

Resolution: worksforme
Status: newclosed

Seems to be out-dated issues, closing

Note: See TracTickets for help on using tickets.