LEADTOOLS Support
General
General Questions
Cannot create JPG images with ConvertCtrl
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, July 8, 2013 8:02:37 AM(UTC)
Groups: Registered
Posts: 6
I'm using the eval version of Leadtools MM v.18 and successfully transcoding video to H264 using ConvertCtrl from a c# .net app. I don't seem to be able to get SaveStillBitmap to create a viewable JPG image though, it will save a BMP however. If I specify JPEGnnn (any of the 3 options), it creates a file with a .jpg extension that has size but cannot be displayed by Windows or any viewer app. e.g.
public bool TranscodeVideo(String sourceFile, String targetPath) {
try {
// H264 video in ISO (mp4) format with AAC audio
Converter.VideoCompressors.H264.Selected = true;
Converter.AudioCompressors.AAC.Selected = true;
Converter.TargetFormat = TargetFormatType.ISO;
Converter.EnableStillCapture = true;
Converter.StillCaptureLimit = 1000;
Converter.SourceFile = sourceFile;
Converter.TargetFile = Path.Combine(targetPath, Path.GetFileNameWithoutExtension(sourceFile) + ".mp4");
Converter.StartConvert();
Converter.SaveStillBitmap(Path.Combine(targetPath, Path.GetFileNameWithoutExtension(sourceFile) + ".jpg"), StillFormatType.JPEG411, 0, 0, -1); // doesn't work!
Converter.SaveStillBitmap(Path.Combine(targetPath, Path.GetFileNameWithoutExtension(sourceFile) + ".bmp"), StillFormatType.BMP, 0, 0, -1); // works!
return true;
}
catch (Exception e) {
return false;
}
}
#2
Posted
:
Monday, July 8, 2013 2:18:05 PM(UTC)
Groups: Registered
Posts: 6
Never mind, I found it. The example in the help showed 0 as the quality value, but the description if you click on "compression quality factors" shows only 2-255 as valid. I changed it to 2 and it works.
#3
Posted
:
Tuesday, July 16, 2013 1:15:07 AM(UTC)
Groups: Registered
Posts: 256
When you pass 0 as quality factor for JPEG images, this means that you will save it as lossless JPEG. And not all applications support Lossless JPEG. Before saving a file using Lossless JPEG, make sure your reader supports it.
And Windows photo viewer does NOT support Lossless JPEG.
You can try to open the lossless images using LEADTOOLS SDK or any viewer that supports lossless JPEG.
For example try loading the image using our Main Imaging demo that is shipped with our toolkit and see that it displays correctly.
LEADTOOLS Support
General
General Questions
Cannot create JPG images with ConvertCtrl
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.