| Summary: | Saving resolution info in Images | ||
|---|---|---|---|
| Product: | [Applications] kooka | Reporter: | Bastian Frank <bf> |
| Component: | general | Assignee: | Klaas Freitag <freitag> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | CC: | maxantispam |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Bastian Frank
2005-12-28 12:04:42 UTC
The Gimp complains about wrong resolution info in files created by Kooka. "Resolution out of bounds" Hey, I think this is the same bug here: http://bugs.kde.org/show_bug.cgi?id=129645 *** This bug has been confirmed by popular vote. *** *** Bug 129645 has been marked as a duplicate of this bug. *** SVN commit 689188 by mkoller:
BUG: 119110
Correctly retrieve the x/y scan resolution and store it
into the scanned image
M +28 -9 kscandevice.cpp
--- branches/KDE/3.5/kdegraphics/libkscan/kscandevice.cpp #689187:689188
@@ -60,12 +60,13 @@
{
public:
KScanDevicePrivate()
- : currScanResolution(0)
+ : currScanResolutionX(0),
+ currScanResolutionY(0)
{
}
- int currScanResolution;
+ int currScanResolutionX, currScanResolutionY;
};
@@ -788,13 +789,16 @@
}
/* Set scan resolution for preview. */
- if( optionExists( SANE_NAME_SCAN_Y_RESOLUTION ) )
+ if( !optionExists( SANE_NAME_SCAN_Y_RESOLUTION ) )
+ d->currScanResolutionY = 0;
+ else
{
KScanOption yres ( SANE_NAME_SCAN_Y_RESOLUTION );
/* if active ? */
storeOptions->backupOption( yres );
yres.set( set_dpi );
apply( &yres );
+ yres.get( &d->currScanResolutionY );
/* Resolution bind switch ? */
if( optionExists( SANE_NAME_RESOLUTION_BIND ) )
@@ -811,8 +815,10 @@
apply( &res );
/* Store the resulting preview for additional image information */
- res.get( &d->currScanResolution );
+ res.get( &d->currScanResolutionX );
+ if ( d->currScanResolutionY == 0 )
+ d->currScanResolutionY = d->currScanResolutionX;
/* Start scanning */
KScanStat stat = acquire_data( true );
@@ -914,6 +920,18 @@
kdDebug(29000) << "Option <" << so->getName() << "> is not active !" << endl;
}
}
+
+ /** Scan Resolution should always exist. **/
+ KScanOption res( SANE_NAME_SCAN_RESOLUTION );
+ res.get( &d->currScanResolutionX );
+ if ( !optionExists( SANE_NAME_SCAN_Y_RESOLUTION ) )
+ d->currScanResolutionY = d->currScanResolutionX;
+ else
+ {
+ KScanOption yres( SANE_NAME_SCAN_Y_RESOLUTION );
+ yres.get( &d->currScanResolutionY );
+ }
+
return( acquire_data( false ));
}
else
@@ -1169,13 +1187,14 @@
if( status == KSCAN_OK && img )
{
ImgScanInfo info;
- /* FIXME: Both resolutions are equal here but should be
- * x and y different
- */
- info.setXResolution(d->currScanResolution);
- info.setYResolution(d->currScanResolution);
+ info.setXResolution(d->currScanResolutionX);
+ info.setYResolution(d->currScanResolutionY);
info.setScannerName(shortScannerName());
+ // put the resolution also into the image itself
+ img->setDotsPerMeterX(static_cast<int>(d->currScanResolutionX / 0.0254 + 0.5));
+ img->setDotsPerMeterY(static_cast<int>(d->currScanResolutionY / 0.0254 + 0.5));
+
if( scanningPreview )
{
kdDebug(29000) << "Scanning a preview !" << endl;
|