Hi,
I've detected some performance problem with fax group4 conversion, here I'll try to describe how to reproduce it:
From terminal I execute the command what takes about ( 3-5 seconds )
convert -threshold 80% -compress group4 C:\Users\DXD\Pictures\OKMSc
an\Images\2014-5-6\Scanned-1.jpeg C:\Users\DXD\Pictures\OKMScan\Images\2014-5-6\
Scanned-2.jpeg C:\Users\DXD\Pictures\OKMScan\Images\2014-
5-6\pdf4.pdf
But when I try same action from my source code it takes several minutes ( more than 3 minutes ), here's mu method
public void convertToPdf(List<String> pathList, int percentage)
{
int number = 0;
if (pathList != null && pathList.Count > 0)
{
if (!existFolder(destPath + folderRoot, folderName))
{
createFolder(destPath + folderRoot, folderName);
}
number = findLastFile(destPath + folderRoot + folderName) + 1;
using (MagickImageCollection collection = new MagickImageCollection())
{
foreach (var path in pathList)
{
MagickImage image = new MagickImage(path);
image.Threshold(percentage);
image.CompressionMethod = CompressionMethod.Group4;
collection.Add(image);
}
collection.Write(destPath + folderRoot + folderName + "\\" + fileName + "-" + number.ToString() + ".pdf");
}
}
}
To execute simply provide a list of file paths. The method takes a lot of time in line collection.Write
Note: I'm trying with 5 color jepg files with about 900kb and 3307x4677px
Comments: ** Comment from web user: dlemstra **
I've detected some performance problem with fax group4 conversion, here I'll try to describe how to reproduce it:
From terminal I execute the command what takes about ( 3-5 seconds )
convert -threshold 80% -compress group4 C:\Users\DXD\Pictures\OKMSc
an\Images\2014-5-6\Scanned-1.jpeg C:\Users\DXD\Pictures\OKMScan\Images\2014-5-6\
Scanned-2.jpeg C:\Users\DXD\Pictures\OKMScan\Images\2014-
5-6\pdf4.pdf
But when I try same action from my source code it takes several minutes ( more than 3 minutes ), here's mu method
public void convertToPdf(List<String> pathList, int percentage)
{
int number = 0;
if (pathList != null && pathList.Count > 0)
{
if (!existFolder(destPath + folderRoot, folderName))
{
createFolder(destPath + folderRoot, folderName);
}
number = findLastFile(destPath + folderRoot + folderName) + 1;
using (MagickImageCollection collection = new MagickImageCollection())
{
foreach (var path in pathList)
{
MagickImage image = new MagickImage(path);
image.Threshold(percentage);
image.CompressionMethod = CompressionMethod.Group4;
collection.Add(image);
}
collection.Write(destPath + folderRoot + folderName + "\\" + fileName + "-" + number.ToString() + ".pdf");
}
}
}
To execute simply provide a list of file paths. The method takes a lot of time in line collection.Write
Note: I'm trying with 5 color jepg files with about 900kb and 3307x4677px
Comments: ** Comment from web user: dlemstra **
It looks like you are using the Q16 version of Magick,NET. If you use Magick.NET to create PDF files from scanned monochrome images you should switch to the Q8 version to reduce memory usage. When Magick.NET uses too much memory it will switch to disk cache. And that will dramatically reduce the performance of your application.