Editing
Raster image I/O
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Converting RSF 2-D data to raster images== If Madagascar has been compiled with TIFF support, <tt>sfbyte2tif</tt> can be used: <bash> < model.rsf sfbyte | sfbyte2tif > model.tif </bash> If Madagascar has been compiled with JPEG support, <tt>sfbyte2jpg</tt> can be used: <bash> < model.rsf sfbyte | sfbyte2jpg > model.jpg </bash> Then, another program can be used to convert the JPEG file to another format. If [http://www.imagemagick.org ImageMagick] is present, it can be used to convert a RSF binary to almost any image format. In a SConstruct, the workflow would look like: <python> Flow('data.gray','data', ''' transp | # Make data in row-major order byte gainpanell=all allpos=y | # Convert data to byte representation disfil col=1 number=n format="%02X" | # Dump data in one column in ASCII-hex xxd -r -p # Read ASCII output and convert it to binary form ''') Flow('data.png','data.gray', ''' convert -size %dx%d -depth 8 ${SOURCES[0]} ${TARGETS[0]} # Run ImageMagick ''' % (n2, n1), stdin=0, stdout=0) </python> To output to another format, just change the extension in the last <tt>Flow()</tt> from .png to .gif or .jpg, for example. Create the output simply by running: <tt>scons data.png</tt>
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information