Comment PNG Image display issue.

Cecil

19+ years progress programming and still learning.
Hi Guys,
Just want to share an issue that I had experienced and managed to resolve.

I'm displaying a PNG image that was dynamically generated by a 3rd party software and I was experiencing a rendering issue when using the IMAGE widget.
Progress KBASE showed that this was a known issue Progress Customer Community.
However, I'm running on OpeneEdge 11.7.15 64bit which should have resolved this issue.

The PNG image would open successfully in any other paint program.
My solution was to use .NET to open the image (in memory), copy it to a new bitmap image and then save it back to disk.

Hopefully, this might help someone else.
Code:
using System.Drawing.*.
using System.Drawing.Imaging.*.

procedure FixPNGInterlace private :

    define input parameter pPNGImage as character.
    
    define variable originalImage as class System.Drawing.Bitmap   no-undo.
    define variable newImage      as class System.Drawing.Bitmap   no-undo.
    define variable graphics      as class System.Drawing.Graphics no-undo.
    
    // Load the PNG image
    originalImage = new Bitmap(pPNGImage).
    
    // Create a new PNG image with specified interlace mode
    newImage = new Bitmap(originalImage:Width, originalImage:Height, PixelFormat:Format32bppArgb).
    
    graphics = System.Drawing.Graphics:FromImage(newImage).
    
    graphics:DrawImage(originalImage, new System.Drawing.Rectangle(0,0, newImage:Width, newImage:Height) ).
    
    // Save the new PNG image with changed interlace mode
    newImage:Save(pPNGImage + '.fixed', ImageFormat:Png).
    
    finally:
        
        // Dispose of resources
        if valid-object(originalImage) then
            originalImage:Dispose().
            
        if valid-object(newImage) then   
            newImage:Dispose().
            
        if valid-object(newImage) then   
            delete object graphics.           
        
        os-delete value(pPNGImage).
        os-rename value(pPNGImage + '.fixed') value(pPNGImage).
    end finally.

end procedure.
 

Cecil

19+ years progress programming and still learning.
OE 12.8 64bit and OE 11.7 32bit are not effected with the PNG corruption,

So, far for me only 11.7 64bit is effected by the PNG interlacing issue.
 

missguided79

New Member
Hi Guys,
Just want to share an issue that I had experienced and managed to resolve.

I'm displaying a PNG image that was dynamically generated by a 3rd party software and I was experiencing a rendering issue when using the IMAGE widget.
Progress KBASE showed that this was a known issue Progress Customer Community.
However, I'm running on OpeneEdge 11.7.15 64bit which should have resolved this issue.

The PNG image would open successfully in any other paint program.
My solution was to use .NET to open the image (in memory), copy it to a new bitmap image and then save it back to disk.

Hopefully, this might help someone else.
Code:
using System.Drawing.*.
using System.Drawing.Imaging.*.

procedure FixPNGInterlace private :

    define input parameter pPNGImage as character.
   
    define variable originalImage as class System.Drawing.Bitmap   no-undo.
    define variable newImage      as class System.Drawing.Bitmap   no-undo.
    define variable graphics      as class System.Drawing.Graphics no-undo.
   
    // Load the PNG image
    originalImage = new Bitmap(pPNGImage).
   
    // Create a new PNG image with specified interlace mode
    newImage = new Bitmap(originalImage:Width, originalImage:Height, PixelFormat:Format32bppArgb).
   
    graphics = System.Drawing.Graphics:FromImage(newImage).
   
    graphics:DrawImage(originalImage, new System.Drawing.Rectangle(0,0, newImage:Width, newImage:Height) ).
   
    // Save the new PNG image with changed interlace mode
    newImage:Save(pPNGImage + '.fixed', ImageFormat:Png).
   
    finally:
       
        // Dispose of resources
        if valid-object(originalImage) then
            originalImage:Dispose().
           
        if valid-object(newImage) then  
            newImage:Dispose().
           
        if valid-object(newImage) then  
            delete object graphics.          
       
        os-delete value(pPNGImage).
        os-rename value(pPNGImage + '.fixed') value(pPNGImage).
    end finally.

end procedure.
Simply VIEW / Display the PNG image as a webpage NOT an image
> Have a frame and point it 2 the file
 
Top