typemytype / drawbot

http://www.drawbot.com
Other
407 stars 63 forks source link

ImageObject.opTile() error #546

Closed chrisjansky closed 1 year ago

chrisjansky commented 1 year ago

Hello,

I tried using the opTile() filter and got the following error using this minimal setup:

foo = ImageObject()
foo.open("...jpg")
foo.opTile(center=(500, 500), scale=1, angle=1, width=1)
image(foo, (0, 0))

Error:

Traceback (most recent call last):
  File "/Applications/DrawBot.app/Contents/Resources/lib/python3.9/drawBot/ui/drawBotController.py", line 117, in createContext
  File "/Applications/DrawBot.app/Contents/Resources/lib/python3.9/drawBot/drawBotDrawingTools.py", line 101, in _drawInContext
  File "/Applications/DrawBot.app/Contents/Resources/lib/python3.9/drawBot/context/baseContext.py", line 2594, in image
  File "/Applications/DrawBot.app/Contents/Resources/lib/python3.9/drawBot/context/pdfContext.py", line 280, in _image
  File "/Applications/DrawBot.app/Contents/Resources/lib/python3.9/drawBot/context/pdfContext.py", line 269, in _getImageSource
objc.error: NSInternalInconsistencyException - Invalid parameter not satisfying: cgImage != NULL

I haven’t found any documented use of opTile() anywhere, is it supposed to be working?

Thanks!

typemytype commented 1 year ago

mmm, it looks like those filters create a infinite extent... drawBot needs to clip it to the original imageObject size

https://developer.apple.com/documentation/coreimage/ciimage/1437833-imagebycroppingtorect?language=objc

typemytype commented 1 year ago

pushed a PR

also check out default values for those filters:https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/#//apple_ref/doc/filter/ci/CIOpTile

chrisjansky commented 1 year ago

@typemytype Yes, that works, thank you for the quick fix!