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

Question

Question

Compression of existing scanned images in Laserfiche repository

asked on December 1, 2014

Hi

Our client is using Laserfiche 9 and is suffering slowness & storage space pains due to huge images been scanned mistakenly in high resolution and color formats. So consuming time in retrieving those images (files), large space in the repository, and finally excess of time been taken for the backup process which took them two to three days to be completed.

Please advise whether there is any possibility to re-size & compress these files into a lower resolution, all at a time, using an automated workflow which can import all such files & process the desired re-size format & output the compress ones.

I have reviewed similar earlier cases posted where the answers replied can handle one file at a time using PhotoDocs, while we are looking for an automated solution to process all at a time.

Kindly advice

0 0

Replies

replied on December 2, 2014 Show version history

Hey there,

The image processing .NET API can be used to compress images en mass. For example, you might want to convert all of the TIFF-LZH images to TIFF-JPG (and set high compression) to decrease their size:

 

 Dim oImgConv As New Laserfiche.Imaging.LfiImageConverter

For Each oLFPage As LFPage In oLFPgs
                    oLFImg = oLFPage.Image
                    RaiseEvent ProcessingPages(oLFPage.PageNum.ToString, oLFPgs.Count.ToString, 1, oLFPgs.Count, oLFPage.PageNum)
                    If oLFImg.BitsPerPixel > 1 Then 'is this colour? Don't convert B&W pages

                        'Read the page into memory
                        oLFRS = oLFImg.ReadStream
                        oLFRS.Open()
                        ReDim oByt(oLFImg.FileInfo.Size)
                        oLFRS.ReadToBuffer(oByt)
                        oSourceFS.Dispose()
                        oSourceFS = New IO.MemoryStream
                        oSourceFS.Write(oByt, 0, oLFImg.FileInfo.Size)
                        oSourceFS.Seek(0, 0)

                        'Decode and test image for format type
                        oLFBMDecoder = New LfiBitmapDecoder(oSourceFS, Windows.Media.Imaging.BitmapCreateOptions.None)
                        If (oLFBMDecoder.Frames(0).Codec = m_intSourceCodec) And (oLFBMDecoder.ContainerFormat = m_intSourceContainer) Then 'candidate for conversion?

                            'Convert the frame/page
                            oDestFS = New IO.MemoryStream
                            oDestFS.Seek(0, 0)
                            oImgConv.Quality = m_intLossyQualityFactor
                            oImgConv.ConvertFile(oSourceFS, 0, oDestFS, m_intDestContainer, m_intDestCodec)

                            '''''''
                            'This code block replaces the compressed page
                            oLFWS = oLFImg.WriteStream
                            oLFWS.Open(oDestFS.Capacity)
                            oDestFS.Seek(0, 0)
                            oLFWS.Write(oDestFS.GetBuffer)
                            oLFWS.Close()
                            oLFWS.Update()
                            '''''''

                        Else 'the image is already a JPG, copy page instead
                            'no op
                        End If
                    Else 'the image is B&W, copy page instead
                        'no op
                    End If
                    If m_blCancel Then Exit For
                Next
                oLFDoc.UnlockObject()
            End If
            oLFNewDoc.Dispose()
            If m_blCancel Then Exit For
        Next

 

3 0
replied on December 2, 2014

Hi Izzat,

 

You could use Quick Fields to convert the images to Black and white. This is the only automated solution "out of the box". There may be a way using the SDK and Workflow, however this may have to be written/coded.

 

The issue you have was discussed in detail here -

https://answers.laserfiche.com/questions/46649/Convert-a-large-number-of-documents-scanned-in-color-to-monochrome

 

Hope this helps!

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

Sign in to reply to this post.