Prevent Images Being Smoothed on Export to PDF

Post questions on how to use or achieve an effect in Inkscape.
FlamingBeeRetry
Posts: 2
Joined: Fri Sep 20, 2013 12:51 am

Prevent Images Being Smoothed on Export to PDF

Postby FlamingBeeRetry » Fri Sep 20, 2013 1:04 am

Hi,

I have many raster images, combined with vector images, in inkscape SVG files. I am exporting these to PDF + TeX so that the images can be included into a Latex document which is then compiled to a PDF file. This was previously working well, however I recently noticed that the raster images are being "smoothed" when they are exported. This did not used to happen. Some of the images are very pixellated and have very large, square pixels. This is the behaviour I need to preserve -- I cannot have the smoothed or anti-aliased in any way. Unfortunately some sort of smoothing is happening, and bright square pixels appear as fuzzy diamonds.

I believe that I was probably using an older version of inkscape (0.46 or 0.47) previously, and it would appear that something has changed in between then and now (0.48.4.r9939). I urgently need to fix this problem as the document (my PhD thesis!) must be submitted in under a week. After searching the forums I've tried to disable bitmap antialiasing (Inkscape preferences -> bitmaps -> oversample bitmaps none) but this doesn't change anything.

Any help on this matter would be greatly appreciated.

Many thanks.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Prevent Images Being Smoothed on Export to PDF

Postby Lazur » Fri Sep 20, 2013 7:00 am

Hi.

Open the saved pdf in a notepad and change the "interpolate - true" part to "interpolate false", resulting in a pixelated render through a pdf viewer.

http://www.inkscapeforum.com/viewtopic.php?f=5&t=15829#p59223

FlamingBeeRetry
Posts: 2
Joined: Fri Sep 20, 2013 12:51 am

Re: Prevent Images Being Smoothed on Export to PDF

Postby FlamingBeeRetry » Fri Sep 20, 2013 5:18 pm

Ah amazing. Somehow I didn't think to search for the word "blurry". This is much better than my makeshift solution of opening the file in an older version of Inkscape (0.48.0 I think). Thank you so much for your help.

Niriel
Posts: 3
Joined: Sat Feb 21, 2015 8:16 pm

Re: Prevent Images Being Smoothed on Export to PDF

Postby Niriel » Mon Feb 23, 2015 8:09 pm

I know I'm resurecting an old post, but this very problem just bit me.
I wasn't able to edit the pdf in my text editor, somehow things would get corrupted because my text editor tried figuring out the encoding of what is mostly a binary file. So I wrote a short quick-and-dirty python script to do the trick. I thought I would share it here, it might help someone someday.

Code: Select all

filename_i = "12co10.pdf"
filename_o = "12co10_crisp.pdf"

data = None
with open(filename_i, "rb") as f:
    data = f.read()

def crisper(s):
    pieces = s.split("Interpolate true", 1)
    if len(pieces) != 2:
        return s
    before, after = pieces
    middle = "Interpolate false"
    new_s = "".join([before, middle, after])
    return crisper(new_s)

new_data = crisper(data)

with open(filename_o, "wb") as f:
    f.write(new_data)

Warning: works with python 2.x, definitely not python 3, since in python 3 all the strings are unicode. Here, I use strings as raw byte arrays.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Prevent Images Being Smoothed on Export to PDF

Postby ragstian » Mon Feb 23, 2015 8:42 pm

Hi.

Clever! New way to use strings. :)
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar


Return to “Help with using Inkscape”