try jpeg resolution
This commit is contained in:
parent
aebdb26ae3
commit
d22e44ee6c
|
@ -1336,12 +1336,22 @@ namespace hg_imgproc
|
||||||
{
|
{
|
||||||
// MSB word[7] and word[8] are x and y resolutions
|
// MSB word[7] and word[8] are x and y resolutions
|
||||||
std::vector<int> cpr;
|
std::vector<int> cpr;
|
||||||
|
unsigned short jpeg_r = (resolution << 8) | ((resolution >> 8) & 0x0ff);
|
||||||
cpr.push_back(CV_IMWRITE_JPEG_QUALITY);
|
cpr.push_back(CV_IMWRITE_JPEG_QUALITY);
|
||||||
cpr.push_back((int)(long)conv->dst.fmt.detail);
|
cpr.push_back((int)(long)conv->dst.fmt.detail);
|
||||||
cpr.push_back(CV_IMWRITE_JPEG_RST_INTERVAL);
|
|
||||||
cpr.push_back(resolution);
|
|
||||||
if (conv->dst.is_file)
|
if (conv->dst.is_file)
|
||||||
|
{
|
||||||
cv::imwrite(conv->dst.data, imsg, cpr);
|
cv::imwrite(conv->dst.data, imsg, cpr);
|
||||||
|
|
||||||
|
//FILE* f = fopen(conv->dst.data, "rb+");
|
||||||
|
//if (f)
|
||||||
|
//{
|
||||||
|
// fseek(f, 0x0e, SEEK_SET);
|
||||||
|
// fwrite(&jpeg_r, sizeof(jpeg_r), 1, f);
|
||||||
|
// fwrite(&jpeg_r, sizeof(jpeg_r), 1, f);
|
||||||
|
// fclose(f);
|
||||||
|
//}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string tmpf(hg_log::temporary_path() + PATH_SEPARATOR + "imgtrans.tmp");
|
std::string tmpf(hg_log::temporary_path() + PATH_SEPARATOR + "imgtrans.tmp");
|
||||||
|
@ -1350,6 +1360,8 @@ namespace hg_imgproc
|
||||||
conv->dst.data = (SANE_String_Const)G4Tiff::load_mini_file(tmpf.c_str(), &bytes, allocate_memory);
|
conv->dst.data = (SANE_String_Const)G4Tiff::load_mini_file(tmpf.c_str(), &bytes, allocate_memory);
|
||||||
conv->dst.data_len = bytes;
|
conv->dst.data_len = bytes;
|
||||||
remove(tmpf.c_str());
|
remove(tmpf.c_str());
|
||||||
|
//if (conv->dst.data_len > 0x20)
|
||||||
|
// ((unsigned short*)conv->dst.data)[7] = ((unsigned short*)conv->dst.data)[8] = jpeg_r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (conv->dst.fmt.compress.compression == SANE_COMPRESSION_GROUP4)
|
else if (conv->dst.fmt.compress.compression == SANE_COMPRESSION_GROUP4)
|
||||||
|
|
Loading…
Reference in New Issue