You are viewing limited content. For full access, please sign in.

Question

Question

8.3 SDK not compressing images like 8.0

asked on January 6, 2015

Imports LFSO83Lib
Imports DocumentProcessor83

Module Module1

  Sub Main()
    Dim app As LFApplication = New LFApplication
    Dim serv As LFServer
    Dim db As LFDatabase
    Dim conn As New LFConnection


    Try
      serv = app.GetServerByName("127.0.0.1")
      db = serv.GetDatabaseByName("Rep")
      conn.Shared = True
      conn.UserName = "user"
      conn.Password = "pwd"
      conn.Create(db)

      AddImage(db)

      conn.Terminate()

    Catch ex As Exception
      Console.WriteLine(ex.Message)
    End Try

    Console.ReadLine()

  End Sub

  Private Sub AddImage(ByRef db As LFDatabase)
    Dim importer As DocumentImporter = New DocumentImporter()
    Dim lfDoc As LFDocument = New LFDocument()
    Dim lfDir As LFFolder = db.GetEntryByPath("\My Folder\")
    Dim lfVol As LFVolume = db.GetVolumeByName("DEFAULT")

    lfDoc.Create("image test", lfDir, lfVol, True)
    lfDoc.LockObject(Lock_Type.LOCK_TYPE_WRITE)

    importer.Document = lfDoc
    importer.PageAction = Import_Page_Action.IMPORT_PAGE_ACTION_APPEND
    importer.ImportImagesFromFile("C:\Temp\images\sizes\bmp_big.bmp")
    importer.ImportImagesFromFile("C:\Temp\images\sizes\png_big.png")
    importer.ImportImagesFromFile("C:\Temp\images\sizes\png_small.png")
    importer.ImportImagesFromFile("C:\Temp\images\sizes\tif_small.tif")
    importer.ImportImagesFromFile("C:\Temp\images\sizes\png_small2.png")

    lfDoc.UnlockObject()

  End Sub

End Module

Using images:

bmp_big.bmp     519 KB

png_big.png     281 KB

png_small.png     33 KB

tif_small.tif     3 KB

png_small2.png     3 KB

 

When executing the above code with the images using the LFSO80, I get significant image compression for the color images in LF, with color images being ~55 KB after import. (54KB, 55KB, 56KB, 3KB, 2KB)

When executing using the LFSO83, there is little image compression, and in fact the small color PNG increases in size 10x during import. (284KB, 285KB, 350KB, 3KB, 2KB)

 

Black and white images appear stay compressed on import.

Is this a known issue using the 8.3.2 SDK? Is there a newer version of the 8.3.x SDK that fixes the compression to more closely follow the 8.0 SDK?

png_big.png
png_small2.png
png_big.png (280.12 KB)
png_small.png (32.94 KB)
tif_small.tif (2.52 KB)
png_small2.png (2.18 KB)
1 0

Answer

SELECTED ANSWER
replied on January 9, 2015 Show version history

We plan to add an option to the Laserfiche RepositoryAccess.NET SDK for recompressing images in the document importer. This will be for a future version.

Thanks for reporting this issue.

1 0

Replies

replied on January 7, 2015

It appears that your "png_small.png" file is actually a TIFF_JPEG file with the mismatched file extension of "png". This explains why this file is small.

1 0
replied on January 6, 2015

For the user that your application is connecting as, try using the [Settings]JPEGCompression attribute and set it to 50 or lower. If that doesn't help with the image size, then try using the DocumentProcessor83 library that should be included in SDK 9.2 along with the attribute.

0 0
replied on January 8, 2015

I was able to put in the HKCU\Software\Laserfiche\Client8\Profile\Settings\JPEGCompression registry value set to 50, but it did not appear to make a difference using either the native 8.3 SDK or the 8.3 SDK installed with the 9.2 SDK. I got the same file sizes in LF.

 

I also tested with the 9.0 SDK and the file sizes were the same as 8.3; however, testing with both the 9.1 and 9.2 SDK I found that all the image sizes were preserved as expected. Exploring a migration of our products to one of the newer SDKs is a workaround we will discuss.


The automatic image compression that the 8.0 SDK was doing was very convenient, and we would be pleased if the latest SDK did the same. That said, I understand the logic of images remaining about the same size after import. But the case where the image increases in size after import (png_small.png) is a much larger concern for us. I did rename the png_small.png to png_small.tif but the import still increased the file size from 33KB to 350KB. (Thanks to Kin-Chung Wong for the tip on the image format, though.)

 

1. Will the 8.3 and 9.0 SDKs be modified to not increase the size of color TIF images after import?

2. Will an image compression option be introduced into any version of the SDK in the future?


Thank you.

0 0
replied on January 14, 2015

Thank you for the update on the SDK. We will do some image compression before the import for now.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.