Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29286 Discussions

Problem with Quickwin routine SAVEIMAGE and workaround

dboggs
New Contributor I
404 Views

I often use the routine SAVEIMAGE to save an entire window image to a file. When printing that image, or inserting it into a Word document etc., black lines always appear along the right and bottom edges. I have figured out why and how to fix it.

If the window size is, say, NXPIXELS x NYPIXELS, and code is for example

[fortran]
NXPIXELS = 800
NXPIXELS = 600
I4 = SAVEIMAGE (FILENAME, 0,0, NXPIXELS, NYPIXELS)
[/fortran]

you will find that the resulting image is actually 801 x 601, and the extra pixels at the right and bottom are black! The problem can be fixed by

[fortran]
 I4 = SAVEIMAGE (FILENAME, 0,0, NXPIXELS-1, NYPIXELS-1) [/fortran]

In defence of Intel, the documentation is a little nebulous about the arguments defining a "bounding rectangle" around the desired part of the window image, but in my opinion this is a bug and should be fixed--or at least include a warning about what happens when you try to save an entire window. (I have not investigated what happens when you save a portion of a window, or use 1,1 as the upper left corner instead of 0,0.)

0 Kudos
1 Reply
dboggs
New Contributor I
404 Views

On reflection, I'm not sure I can blame Intel's documentation at all. I note that when a window is created, you specify NUMXPIXELS, NUMYPIXELS. The address of the upper left corner is (0, 0) and the address of the lower right corner is (NUMXPIXELS-1, NUMYPIXELS-1). So when you ask to save an image as I did above, you are actually asking for a size of 801 x 601. What else can the compiler do but make the extra pixels black? So the proper statement is

I4 = SAVEIMAGE (FILENAME, 0,0, NXPIXELS-1, NYPIXELS-1)

and this is simply the prudent thing to do. I only wish that the documentation for SAVEIMAGE explained this a bit. An example would be good.

 

0 Kudos
Reply