pytroll / pytroll/aggdraw

The value in the coordinates list cannot exceed 32767.

Open
#84 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In my project, I need to draw an image with a large size. But when I used the line method, I found that some lines could not be drawn. After testing, I found that if the value of coordinate of a point in the list of coordinates (both horizontal and vertical) exceeds 32767, then the line method will not draw the line, while Pillow does.

I have used the following code for testing.

from aggdraw import Draw, Pen
from PIL import Image, ImageDraw

im = Image.new('RGB', (40000, 1000), 'white')

# No problem when using Pillow, which draws a horizontal bar up to 40000 pixels long.
draw = ImageDraw.Draw(im)
draw.line((0, 250, 40000, 250), fill='red', width=500)

# This line cannot be drawn unless I change this value to 32767 or less.
draw2 = Draw(im)
pen = Pen(color=(0, 0, 255), width=500)
draw2.line((0, 750, 32768, 750), pen)
draw2.flush()

im.show()

In addition, this problem occurs in other methods that require a list of coordinates to be entered (such as path).

  • Windows 10
  • Python: 3.10
  • Pillow: 9.1.1
  • aggdraw: 1.3.15

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.

Research direction

Reproduce the issue with the supplied Python example, then trace coordinate handling for the line and path methods into the C++ drawing implementation. Check why values above 32767 are not drawn, and verify that the example renders the full 40000-pixel line while preserving coordinate handling for paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.