Rework image conversion logic
...and allow more image formats
This commit is contained in:
parent
aad58cf4c6
commit
cb0c0e0e3d
2 changed files with 13 additions and 6 deletions
|
@ -22,15 +22,15 @@ function supported_formats(printer, ConvertChecker, considerAdditionalFormats)
|
|||
supported.push("Postscript");
|
||||
}
|
||||
|
||||
if (raster || has(formats, "image/jpeg"))
|
||||
if (raster || has(formats, "image/jpeg") || has(formats, "image/png") || has(formats, "image/gif"))
|
||||
{
|
||||
mimetypes.push("image/jpeg");
|
||||
supported.push("JPEG");
|
||||
}
|
||||
if(raster || has(formats, "image/png"))
|
||||
{
|
||||
mimetypes.push("image/png");
|
||||
supported.push("PNG");
|
||||
mimetypes.push("image/tiff");
|
||||
mimetypes.push("image/gif");
|
||||
|
||||
}
|
||||
|
||||
return {supported: supported.join(" "), mimetypes: mimetypes};
|
||||
|
@ -242,7 +242,7 @@ function limitChoices(name, choices, mimeType, ConvertChecker)
|
|||
}
|
||||
|
||||
}
|
||||
else if(mimeType == "image/jpeg" || mimeType == "image/png")
|
||||
else if(mimeType.indexOf("image") != -1)
|
||||
{
|
||||
return choices.filter(canConvertImageTo);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,14 @@ QString targetFormatIfAuto(QString documentFormat, QString mimeType, QJsonArray
|
|||
}
|
||||
else if (mimeType.contains("image"))
|
||||
{
|
||||
return firstMatch(supportedMimeTypes, {"image/png", "image/gif", "image/jpeg", "image/pwg-raster", "image/urf"});
|
||||
QStringList ImageFormatPrioList {"image/png", "image/gif", "image/pwg-raster", "image/urf", "image/jpeg"};
|
||||
if(mimeType == "image/jpeg")
|
||||
{
|
||||
// Prioritize transferring JPEG as JPEG, as it will not be transcoded
|
||||
// Normally, it is the last choice (as the others are lossless)
|
||||
ImageFormatPrioList.prepend(mimeType);
|
||||
}
|
||||
return firstMatch(supportedMimeTypes, ImageFormatPrioList);
|
||||
}
|
||||
return documentFormat;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue