Imported bitmap appear blurry when zoomed in

Bug #1163449 reported by pRototype
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Tavmjong Bah

Bug Description

The behaviour occurs in following versions:
Inkscape 0.48+devel r12228
Inkscape 0.48+devel r12248

Versions that is NOT affected:
Inkscape 0.48+devel r12217

OS: Windows XP and Windows 7. Similar behaviour on XP and seven.

Description:
An imported graphic image with high contrasts (maps, schemas, etc) occurs blurry when zoomed in. Sample images (inside zip file) shows how. The graphic file in this case is a screen copy of Windows Explorer showing folder contents of Inkscape root folder.

Why is this a problem?
When I have t.ex a schematic or pixelated graphics from other programs, I'm normally able to mask some unwanted pixels simply by placing a rectangle over it (snapping to grid lines 1x1px). It's not possible to do that any more because I never really know what excact color to use OR to pace a rectangle properly to fake a pixel.
That is - I need to see each pixels to be able to do spesific changes to existing diagrams and schematics.

I have not found any options in the Preferences dialog box that can make reverse the behaviour.

Revision history for this message
pRototype (regeir) wrote :
su_v (suv-lp)
tags: added: renderer-cairo
tags: added: bitmap
Revision history for this message
jazzynico (jazzynico) wrote :

Very likely to be related to the down-sampling changes in revision 12227 (http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/12227). See Bug #804162.

Revision history for this message
su_v (suv-lp) wrote :
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
tags: added: regression
Revision history for this message
Bryce Harrington (bryce) wrote :

This was an upstream bug in cairo, which has been fixed in Cairo trunk but not yet released.

No changes are required of Inkscape except to rebuild against the fixed library. Packages of cairo/pixman/inkscape for testing the fix are available in my backports PPA.

Changed in inkscape:
status: New → Fix Committed
assignee: nobody → Bryce Harrington (bryce)
Revision history for this message
su_v (suv-lp) wrote :

@Bryce - could you refer me to the commit in cairo master which fixes _upscaling_?

(the downscale patch for cairo does not fix the issue described here - bitmap images imported at 1:1, aligned to the pixel-grid, are still blurry when zooming in. Tested on OS X with r12602 and patched cairo 1.12.16 (downscaling is ok))

Revision history for this message
su_v (suv-lp) wrote :

> Tested on OS X with r12602 and patched cairo 1.12.16 (downscaling is ok))

Bitmap images are blurry when zooming in with patched and with unpatched cairo 1.12.16, btw. Seems that this part is done by Inkscape and was not reverted in r12599.

Revision history for this message
su_v (suv-lp) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Now tested with r12602 and cairo master as well - the problem as reported here is not "fixed" by latest upstream cairo.

AFAIU the proposal on the mailing list was that inkscape could support the attribute 'image-rendering' to control how scaling is
done (e.g. 'image-rendering="optimizeSpeed"' to prevent smoothing of a bitmap image when zooming in closer) [1]:
This property works ok with a test drawing/image in Squiggle (Batik 1.7), but not with current inkscape trunk which seems to ignore the property for rendering the embedded bitmap image.

Proposing to either reopen this report ("RFE: Support rendering hints for bitmap images"), or closing as 'Won't Fix' (?).

[1] related links:
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/40121/focus=40214>
<http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty>

Revision history for this message
su_v (suv-lp) wrote :

Sample file used to test rendering hints.

Revision history for this message
ScislaC (scislac) wrote :

~suv is correct and provided links to adequate related discussion.

Changed in inkscape:
status: Fix Committed → Confirmed
assignee: Bryce Harrington (bryce) → nobody
tags: added: blocker
Bryce Harrington (bryce)
Changed in inkscape:
importance: Undecided → High
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Just checked in a partial fix. I am not sure which versions of pixman/cairo are required.
Note, fix will not work with ~suv's test file as fix requires the property "image-rendering"
to be set in the style attribute, not as a standalone presentation attribute. I'll look into
fixing that in the future.

su_v (suv-lp)
Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
status: Confirmed → In Progress
Revision history for this message
su_v (suv-lp) wrote :

Tavmjong Bah wrote:
> I am not sure which versions of pixman/cairo are required.

Partial fix (r12796) tested successfully on OS X 10.7.5 with attached sample file [1] using
- pixman 0.26.2, cairo 1.12.2
- pixman 0.28.2, cairo 1.12.14
- pixman 0.32.0, cairo 1.12.16 (patched)

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Just checked in a fix to a typo in style.cpp which now allows reading in "image-rendering" as an attribute.

I suppose the next step is to provide a GUI for setting "image-rendering". I am not sure that that counts as a blocker.

Note: This trick to get keep blocky pixels on down scaling does not work in Opera and Chrome. It does work in Firefox.

I've attached a simplified SVG to test the various values of "image-rendering".

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Added GUI three places:

1. Import dialog
2. Inkscape Preferences
3. Object Properties dialog

This should compete the fix for this bug.

Revision history for this message
su_v (suv-lp) wrote :

Tavmjong Bah wrote:
> 3. Object Properties dialog

How about adding it to the 'Image Properties' dialog instead (or as well)? This is the top-most entry in the context menu of a selected bitmap image …
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/ui/dialog/object-attributes.cpp>

tags: removed: blocker
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote : Re: [Bug 1163449] Re: Imported bitmap appear blurry when zoomed in

On Tue, 2013-11-19 at 12:30 +0000, ~suv wrote:
> Tavmjong Bah wrote:
> > 3. Object Properties dialog
>
> How about adding it to the 'Image Properties' dialog instead (or as well)? This is the top-most entry in the context menu of a selected bitmap image …
> <http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/ui/dialog/object-attributes.cpp>

I looked at that first but it was easier to add to the "Object
Properties" dialog. The "Image Properties" dialog should really be
merged with the "Object Properties" dialog. There is no reason for it to
be separate (and both are somewhat misnamed as they mostly effect
Attribute values, not Property values in the SVG/CSS/HTML terminology).

Tav

Revision history for this message
su_v (suv-lp) wrote :

On 2013-11-19 13:48 +0100, Tavmjong Bah wrote:
> The "Image Properties" dialog should really be merged with the
> "Object Properties" dialog.

Filed separately:
- Bug #1252991 “RFE: merge 'Image Properties' and 'Object Properties' dialogs”
  <https://bugs.launchpad.net/inkscape/+bug/1252991>

Changed in inkscape:
status: In Progress → Fix Committed
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.