pytroll / pytroll/aggdraw

Resolve differences after agg 2.2 and agg 2.4 migration

Open
#67 4 comments 0 reactions 1 assignee View on GitHub

@djhoese is already working on this.

Since May 17, 2020.

bug priority: high
Dominant language
C++
Stars
107
Forks
45
Avg merge
13h 41m
Merged PRs (30d)
7

Description

In #50 aggdraw master was updated to use the agg C++ library by @dov. Later it was pointed out by @a-hurst that there were some differences between aggdraw using agg 2.2 and aggdraw using 2.4 in issue #61 which was resolved in #62. At the end of #61 @a-hurst and I started discussing some of the other differences we were noticing with the C++ library changes. As it stands, the master branch (unreleased) does not produce matching results to the aggdraw 1.3.x release. I'd like to figure this out once and for all so I've broken my example from the pycoast package down in to a simpler case. Here is the big pycoast-based result difference from #61:

aggdraw 1.3.x:

image

aggdraw 1.4 (master):

image

Look at the smaller polygons (islands) for the biggest difference. If I strip this down to this code example:

import aggdraw
from PIL import Image
import os
width = 200
height = 200
img = Image.new('RGB', (width, height))
draw = aggdraw.Draw(img)

pen = aggdraw.Pen('white', 1, 255)
coordinates = [166.56794437411008, 77.25389224364426, 48.00197334018185, 78.96339024123063, 81.28185670937546, 83.30298429919458, 89.3666036554605, 154.98793226592443, 88.69627544716832, 84.44108529130517]
draw.line(coordinates, pen)
draw.flush()
img.save('new.png')

And you run that with both versions (obviously change the filename), you will see extremely small differences like the below.

aggdraw 1.3.x:

old

aggdraw 1.4 (master):

new

Note that including the change for line:

https://github.com/pytroll/aggdraw/blob/14a862e6124efe3570e34a0b8dfac8dcc8f65d71/agg/src/agg_vcgen_contour.cpp#L28

as suggested by @a-hurst in #61 from 1.0 to 0.5 doesn't seem to have an effect on this use case.

So something has changed and on the small scale it is almost impossible to see but for many lines (the coastlines above) it is much more apparent. Does anyone have any ideas what other values we could play with to make aggdraw produce equivalent results? @a-hurst sorry if I'm forgetting some suggestion from #61.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.