clip and export - clip border visible?

Post questions on how to use or achieve an effect in Inkscape.
Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 12:18 am

I have a problem with clipping a bitmap in Inkscape.

After I export a clipped bitmap into PNG it looks fine. However after I print this PNG into a PDF file, insert it into LibreOffice writer (and save it into a PDF from there as well) I get a thin grey line where my clip path in Inkscape used to be. If I look carefully at the PNG file using GIMP I see that along the clip path I have a thin line of partially transparent pixels - I guess it can have something to do with it? For clipping I tried paths with 0 width, with no stroke, and it doesn't help. Any help appreciated.

I use Inkscape 0.92pre1 on Ubuntu 14.04.3 from the dev ppa.

(First I posted the question on SuperUser http://superuser.com/questions/1086816/ ... er-visible, but seems like it's not getting much attention there)

Polygon
Posts: 298
Joined: Thu Dec 19, 2013 3:27 am

Re: clip and export - clip border visible?

Postby Polygon » Thu Jun 09, 2016 1:19 am

To make it pixel-perfect you need the graphic pixel-aligned per snapping to a pixel-grid:
PixelPerfect.png
PixelPerfect.png (21.43 KiB) Viewed 3372 times


Cheers
P.

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 1:46 am

So, should the bitmap be aligned to pixels grid in Inkscape? But what if it has a totally different resolution from my inkscape document? I tried snapping both the bitmap and the path to the pixel grid, but nothing really changed...

Polygon
Posts: 298
Joined: Thu Dec 19, 2013 3:27 am

Re: clip and export - clip border visible?

Postby Polygon » Thu Jun 09, 2016 1:59 am

Shouldn´t make any difference.
What is what you´re exporting? Page/Drawing/Selection or Custom size? Drawing should clip it perfectly - at least here me making thousands of pixel perfect icons. :mrgreen:

Cheers
P.

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 2:02 am

I'm exporting a selection, and I hide all non-selected objects. Do you think it can make a difference? I tried copying the selection to a new document and exporting Drawing, I got the same artefact...

Polygon
Posts: 298
Joined: Thu Dec 19, 2013 3:27 am

Re: clip and export - clip border visible?

Postby Polygon » Thu Jun 09, 2016 2:14 am

Is there any filter applied to the image?
Reducing the page size to the selection (shift+cmd+D) don´t help either?

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 2:18 am

No filters, and it doesn't help :(
Also, just in case, the clip is not simply a rectangle, but a more complicated shape.

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: clip and export - clip border visible?

Postby Espermaschine » Thu Jun 09, 2016 2:35 am

I dont know anything about this stuff, but i wanna mention: there is an extension called Pixel Snap (under Modify Path) that aligns vectors to the pixel grid.

Why do you need to clip your image ? Cant you just trim it with Gimp ?

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 2:50 am

Thanks, I'll have a look at the extension.

Well, I can, it's just I have already done everything in Inkscape and wanted to simply export what I have. If I have to, I'll do it again in Gimp of course...

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: clip and export - clip border visible?

Postby Espermaschine » Thu Jun 09, 2016 2:53 am

Have you thought about using your clip-shape as a layermask in Gimp ?
Just export your clip as a black and white mask and paste it into a layermask, then apply.

I mix Gimp and Inkscape all the time, with great success.
Of course you could also import a path...i do that with rendering sometimes, because the Bezier Tool is so much better than the Paths Tool in Gimp.

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 3:01 am

Thanks, that's a good idea! Would save some time. I am really not that familiar with Gimp, try to use Inkscape whenever possible.

Polygon
Posts: 298
Joined: Thu Dec 19, 2013 3:27 am

Re: clip and export - clip border visible?

Postby Polygon » Thu Jun 09, 2016 3:03 am

I have no clue what´s going on here. I just can clip to the page/object size. Any other features are pretty sure get anti-aliased whether it´s pixel-perfect or not. And I´m not able to get corresponding page size at Document-setting and page-export and grid! No alignment consistency.
rect8479.png
rect8479.png (99.78 KiB) Viewed 3329 times


Cheers
P.

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: clip and export - clip border visible?

Postby Espermaschine » Thu Jun 09, 2016 3:03 am

I see. There is also a technique to put an image as a pattern fill into a shape and edit the shape:
https://youtu.be/I_4ADLsGA4o

But i think that may not render so well with pdf. Not exactly sure...

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

Re: clip and export - clip border visible?

Postby Lazur » Thu Jun 09, 2016 3:52 am

If it's for an A4 sized document/pixels scaled to real world units the pixel grid might not match right with the page size.

The method you described in the first post is way overcomplicated in the sense of the raster images.

Yes, you can export to a raster image an object to get clean pixel edges.
Then you could embed those back in and use them instead the vectors.
There is also the option of creating a bitmap copy (Alt+B) -you can set the resolution in the preferences somewhere.
By printing to pdf, you rasterize the whole page.
If embedded raster images were off the pixel grid of that rasterization -which who knows at what dpi is at- the result will get smudged.
And if the page was like A4 sized, it just wouldn't work at all.


I'd suggest creating bitmap copies if necessary for that type of work and
saving the drawing as svg, and
using scribus to combine the svg with libreoffice and saving as pdf in scribus.
Then probably you could get to the best result.

User avatar
druban
Posts: 1605
Joined: Fri Nov 20, 2009 10:48 pm

Re: clip and export - clip border visible?

Postby druban » Thu Jun 09, 2016 4:32 pm

I would like to work on solving this for you as it might affect everyone, can you upload an svg that shows this problem as well as the output png? I am thinking the prefs might have some bearing on the matter.
Your mind is what you think it is.

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 7:06 pm

Thanks everyone for the suggestions.
druban, please find svg, png and pdf (printed png) files here: https://yadi.sk/d/Uon26JECsNKWs The svg file has one bitmap image in it with a clip. Would be great if you could figure it out.

User avatar
Maestral
Posts: 934
Joined: Sat Aug 27, 2011 7:10 am

Re: clip and export - clip border visible?

Postby Maestral » Thu Jun 09, 2016 7:37 pm

In the meanwhile...

You`ve used very odd 0.125 thickness for the stroke. Aside of that, stroke does not affect clipping so there`s no need for stroke/s on clipping masks - hence, after I removed it, everything worked as expected.

I`m not sure if IS and Scribus share the exporting routines, but since the unwanted line on the pdf is not of the same width, I presume it`s due to the antialiasing.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Thu Jun 09, 2016 7:54 pm

Are you saying it works for you with no stroke? I have tried it, I still get that weird line in the pdf. What version of Inkscape are you using?

User avatar
Maestral
Posts: 934
Joined: Sat Aug 27, 2011 7:10 am

Re: clip and export - clip border visible?

Postby Maestral » Fri Jun 10, 2016 12:04 am

0.45, but still - as mentioned - stroke does not affect clipping so you really don`t need it on clipping mask.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Fri Jun 10, 2016 12:49 am

OK, I'm wondering whether it's a regression in the newer version of Inkscape then, thanks.

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Fri Jun 10, 2016 8:11 pm

Weird, I tried the pattern approach and have the same issue - the lines where the stroke of the new object would have been are visible in PDFs...

Flyamer
Posts: 11
Joined: Thu Jun 09, 2016 12:15 am

Re: clip and export - clip border visible?

Postby Flyamer » Fri Jun 10, 2016 8:40 pm

Having a white background rectangle helped!


Return to “Help with using Inkscape”

Who is online

Users browsing this forum: No registered users and 2 guests