python-pillow / Pillow

Python Imaging Library (Fork)
https://python-pillow.org
Other
12.29k stars 2.23k forks source link

Unimplemented feature when converting emojis to image #7854

Open BenjaminOddou opened 8 months ago

BenjaminOddou commented 8 months ago

What did you do?

Converting emoji text using Apple Color Emoji.ttc font to png file using pillow. The behavior is different between two macs. On one configuration (see below) the script is correctly generating images from all emoji and on the other hand, for another configuration, the script is returning an error for some emojis.

What did you expect to happen?

309490886-557c029a-ed98-45d5-aed2-4990dbd1366b

What actually happened?

With the second cofiguration, the script returns

❯ python3 test.py
unimplemented feature

Note that it seems to be a problem only for emojis from 15.1 version, see this issue.

What are your OS, Python and Pillow versions?

Configuration where the script is working:

Configuration where the script returns an error:

from PIL import Image, ImageDraw, ImageFont

def convert_emoji_to_png(emoji):
    image_size = (74 , 74) # set image size
    image = Image.new("RGBA", image_size, (0, 0, 0, 0))  # Set transparent background
    font_size = 64  # Adjusted font size
    font_path = "/System/Library/Fonts/Apple Color Emoji.ttc"
    font = ImageFont.truetype(font_path, font_size, encoding='unic')
    draw_position = (int((image_size[0] - font_size) / 2), int((image_size[1] - font_size) / 2))
    draw = ImageDraw.Draw(image)
    draw.text(draw_position, emoji, font=font, embedded_color=True)
    image.show()

try:
    convert_emoji_to_png("πŸšΆβ€βž‘οΈ")
except Exception as e:
    print(e)
nulano commented 8 months ago

unimplemented feature

This sounds like it might be a message from FreeType, the library used by Pillow to render text: https://github.com/python-pillow/Pillow/blob/1b7bcfb6e71bc2c8a02ee4334b8dbd3b5db6e6e6/Tests/test_imagefont.py#L983-L985


How did you install Pillow (on both systems)?

What is the output of python3 -m PIL (please paste the first 26 lines of output from each system)?

radarhere commented 8 months ago

If it's helpful information, I'm on an M1 with macOS 14.3.1, and I don't see the error.

Investigating, https://stackoverflow.com/questions/63742055/freetype-colour-rendering-ft-load-glyph-returns-unimplemented-feature suggests that FreeType being built without FT_CONFIG_OPTION_USE_PNG would raise this error when you're using embedded_color=True.

BenjaminOddou commented 8 months ago

Hello,

for my system (intel mac chip) I installed pillow using brew.

> python3 -m PIL     
--------------------------------------------------------------------
Pillow 10.2.0
Python 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]
--------------------------------------------------------------------
Python modules loaded from /usr/local/lib/python3.12/site-packages/PIL
Binary modules loaded from /usr/local/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.2.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.1
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.0
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.12
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1
--- LIBIMAGEQUANT (Quantization method) support ok, loaded 4.2.2
--- XCB (X protocol) support ok
--------------------------------------------------------------------
BLP
Extensions: .blp
Features: open, save, encode
--------------------------------------------------------------------

@garymh could you share the results from your mac ?

garymh commented 8 months ago

Sure:

❯ python3 -m PIL
--------------------------------------------------------------------
Pillow 10.2.0
Python 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)]
--------------------------------------------------------------------
Python modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
Binary modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.2.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.1
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.1
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.12
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1
--- LIBIMAGEQUANT (Quantization method) support ok, loaded 4.2.2
--- XCB (X protocol) support ok
--------------------------------------------------------------------
BLP
Extensions: .blp
Features: open, save, encode

This is with an Apple M1 Max

radarhere commented 8 months ago

So @garymh is the environment with the error? How did he install Pillow?

nulano commented 8 months ago

@garymh I'm assuming you also installed Pillow using brew?

Could you please provide the output of brew list --versions?

garymh commented 8 months ago

Could you please provide the output of brew list --versions?

Sure, any relevant parts you're looking for though? I'm a dev so I have quite a few things installed πŸ™ƒ

Here are python related things:

pillow 10.2.0_1
python-certifi 2024.2.2
python-setuptools 69.1.1
python@3.11 3.11.8
python@3.12 3.12.2_1
pyyaml 6.0.1_1
nulano commented 8 months ago

Everything related to the font stack. Unless I'm forgetting something, that should be freetype, harfbuzz, fribidi, libraqm, libpng.

garymh commented 8 months ago

Got it!

- freetype 2.13.2
- fribidi 1.0.13
- harfbuzz 8.3.0_1
- libpng 1.6.43
- libraqm 0.10.1
radarhere commented 8 months ago

Could you run the script without embedded_color=True? I expect that difference will allow it to run successfully.

garymh commented 8 months ago

Nope :(

I tried both:

draw.text(draw_position, emoji, font=font)

and

draw.text(draw_position, emoji, font=font, embedded_color=False)

Both gave me unimplemented feature

radarhere commented 8 months ago

It may or may not be helpful, but could we get the full traceback, not just the error string?

So the output of

convert_emoji_to_png("πŸšΆβ€βž‘οΈ")

not just

try:
    convert_emoji_to_png("πŸšΆβ€βž‘οΈ")
except Exception as e:
    print(e)
garymh commented 8 months ago

Sure:

❯ python3 emoji_test.py
Traceback (most recent call last):
  File "/Users/gary/Desktop/emoji_test.py", line 14, in <module>
    convert_emoji_to_png("πŸšΆβ€βž‘οΈ")
  File "/Users/gary/Desktop/emoji_test.py", line 11, in convert_emoji_to_png
    draw.text(draw_position, emoji, font=font, embedded_color=False)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 568, in text
    draw_text(ink)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 510, in draw_text
    mask, offset = font.getmask2(
                   ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageFont.py", line 602, in getmask2
    offset = self.font.render(
             ^^^^^^^^^^^^^^^^^
OSError: unimplemented feature
radarhere commented 8 months ago

I attempted to replicate in macOS 14 arm64 on GitHub Actions, with

brew update
brew install python@3.12 pillow freetype fribidi harfbuzz libpng libraqm

but it passed.

radarhere commented 8 months ago

If you install Pillow from this PyPI wheel, does the problem still occur? https://files.pythonhosted.org/packages/9d/a0/28756da34d6b58c3c5f6c1d5589e4e8f4e73472b55875524ae9d6e7e98fe/pillow-10.2.0-cp312-cp312-macosx_11_0_arm64.whl

I don't expect it to fix it, but if the error still occurs with this, that means I could potentially put together a wheel with better logging for you to run. If it doesn't, are you open to building Pillow from source?

github-actions[bot] commented 8 months ago

Closing this issue as no feedback has been received.

BenjaminOddou commented 5 months ago

The problem still persist on Pillow 10.3.0 @radarhere.

--------------------------------------------------------------------
Pillow 10.3.0
Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]
--------------------------------------------------------------------
Python executable is /opt/homebrew/opt/python@3.12/bin/python3.12
System Python files loaded from /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12
--------------------------------------------------------------------
Python Pillow modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.3.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.12
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1
--- LIBIMAGEQUANT (Quantization method) support ok, loaded 4.2.2
--- XCB (X protocol) support ok

using a test.py script :

from PIL import Image, ImageDraw, ImageFont

def convert_emoji_to_png(emoji, name):
    image_size = (64, 64) # set image size
    image = Image.new("RGBA", image_size, (0, 0, 0, 0))  # Set transparent background
    font_size = 64  # Adjusted font size
    font_path = "/System/Library/Fonts/Apple Color Emoji.ttc"
    font = ImageFont.truetype(font_path, font_size, encoding='unic')
    draw_position = (int((image_size[0] - font_size) / 2), int((image_size[1] - font_size) / 2))
    draw = ImageDraw.Draw(image)
    draw.text(draw_position, emoji, font=font, embedded_color=True)
    image.save(f"{name.replace(':', '')}.png", "PNG")

convert_emoji_to_png("πŸ‘©β€πŸ¦½β€βž‘οΈ", 'test')

outputs :

python3 test.py
Traceback (most recent call last):
  File "/Users/user/Documents/GitHub/alfred-emoji-wine/test.py", line 14, in <module>
    convert_emoji_to_png("πŸ‘©β€πŸ¦½β€βž‘οΈ", 'test')
  File "/Users/user/Documents/GitHub/alfred-emoji-wine/test.py", line 11, in convert_emoji_to_png
    draw.text(draw_position, emoji, font=font, embedded_color=True)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 590, in text
    draw_text(ink)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 529, in draw_text
    mask, offset = font.getmask2(
                   ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageFont.py", line 592, in getmask2
    return self.font.render(
           ^^^^^^^^^^^^^^^^^
OSError: unimplemented feature

I tried the following without any positive result

brew update
brew install python@3.12 pillow freetype fribidi harfbuzz libpng libraqm
radarhere commented 5 months ago

Could you describe in words what you're expecting? The sequence of unicode characters being requested is - woman, zero width joiner, manual wheelchair, zero width joiner, black rightwards arrow, variation selector-16.

If I trim the last two characters from the string, then it renders fine on my machine.

test

BenjaminOddou commented 5 months ago

I was trying to create an image from emoji using the native emoji font on macOS. What character did you trim exactly ? Is my emoji sequence not correct 🀨 ? FYI I am using this list as my emoji source

nulano commented 5 months ago
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1

It seems you are still using brew to install Pillow.

If you are using a wheel from PyPI (e.g. the one linked by @radarhere above), you should see the following:

--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.13, harfbuzz 8.3.0

Could you please test with Pillow installed from PyPI?

This one should work: https://files.pythonhosted.org/packages/5e/77/4cf407e7b033b4d8e5fcaac295b6e159cf1c70fa105d769f01ea2e1e5eca/pillow-10.3.0-cp312-cp312-macosx_11_0_arm64.whl

This would at least let us know if the issue is specific to the brew build of Pillow (or other used libraries).

BenjaminOddou commented 5 months ago

@nulano now

Pillow 10.3.0
Python 3.12.3 (main, Apr  9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]
--------------------------------------------------------------------
Python executable is /opt/homebrew/opt/python@3.12/bin/python3.12
System Python files loaded from /opt/homebrew/opt/python@3.12/Frameworks/Python.framework/Versions/3.12
--------------------------------------------------------------------
Python Pillow modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from /opt/homebrew/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.3.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.14, harfbuzz 8.4.0
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
python3 test.py
Traceback (most recent call last):
  File "/Users/user/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AE55F6CA-27EF-4215-979B-D0CE54F501D7/test.py", line 14, in <module>
    convert_emoji_to_png("πŸ‘©β€πŸ¦½β€βž‘οΈ", 'test')
  File "/Users/user/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AE55F6CA-27EF-4215-979B-D0CE54F501D7/test.py", line 11, in convert_emoji_to_png
    draw.text(draw_position, emoji, font=font, embedded_color=True)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 590, in text
    draw_text(ink)
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageDraw.py", line 529, in draw_text
    mask, offset = font.getmask2(
                   ^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/PIL/ImageFont.py", line 592, in getmask2
    return self.font.render(
           ^^^^^^^^^^^^^^^^^
OSError: unimplemented feature
radarhere commented 5 months ago

What character did you trim exactly ?

I find that running

convert_emoji_to_png("πŸ‘©β€πŸ¦½β€βž‘οΈ"[:-2], 'test')

works. So from your emoji source, I find that 'woman in manual wheelchair', works, but 'woman in manual wheelchair facing right' doesn't.

BenjaminOddou commented 5 months ago

@radarhere I think the problem comes from the right arrow modifier then. All the following emojis have this modifier, here is an example

here are the emojis causing problems :

2024-05-24 22:01:22,360 - ERROR - πŸšΆβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,361 - ERROR - πŸšΆπŸ»β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,362 - ERROR - πŸšΆπŸΌβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,362 - ERROR - πŸšΆπŸ½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,363 - ERROR - πŸšΆπŸΎβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,364 - ERROR - πŸšΆπŸΏβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,365 - ERROR - πŸšΆβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,366 - ERROR - πŸšΆπŸ»β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,366 - ERROR - πŸšΆπŸΌβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,367 - ERROR - πŸšΆπŸ½β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,368 - ERROR - πŸšΆπŸΎβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,369 - ERROR - πŸšΆπŸΏβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,369 - ERROR - πŸšΆβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,370 - ERROR - πŸšΆπŸ»β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,371 - ERROR - πŸšΆπŸΌβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,372 - ERROR - πŸšΆπŸ½β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,373 - ERROR - πŸšΆπŸΎβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,373 - ERROR - πŸšΆπŸΏβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,417 - ERROR - πŸ§Žβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,418 - ERROR - πŸ§ŽπŸ»β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,419 - ERROR - πŸ§ŽπŸΌβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,419 - ERROR - πŸ§ŽπŸ½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,420 - ERROR - πŸ§ŽπŸΎβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,421 - ERROR - πŸ§ŽπŸΏβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,422 - ERROR - πŸ§Žβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,423 - ERROR - πŸ§ŽπŸ»β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,423 - ERROR - πŸ§ŽπŸΌβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,424 - ERROR - πŸ§ŽπŸ½β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,425 - ERROR - πŸ§ŽπŸΎβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,426 - ERROR - πŸ§ŽπŸΏβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,426 - ERROR - πŸ§Žβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,427 - ERROR - πŸ§ŽπŸ»β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,428 - ERROR - πŸ§ŽπŸΌβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,429 - ERROR - πŸ§ŽπŸ½β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,430 - ERROR - πŸ§ŽπŸΎβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,430 - ERROR - πŸ§ŽπŸΏβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,439 - ERROR - πŸ§‘β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,439 - ERROR - πŸ§‘πŸ»β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,440 - ERROR - πŸ§‘πŸΌβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,441 - ERROR - πŸ§‘πŸ½β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,442 - ERROR - πŸ§‘πŸΎβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,443 - ERROR - πŸ§‘πŸΏβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,451 - ERROR - πŸ‘¨β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,452 - ERROR - πŸ‘¨πŸ»β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,453 - ERROR - πŸ‘¨πŸΌβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,453 - ERROR - πŸ‘¨πŸ½β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,454 - ERROR - πŸ‘¨πŸΎβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,455 - ERROR - πŸ‘¨πŸΏβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,464 - ERROR - πŸ‘©β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,465 - ERROR - πŸ‘©πŸ»β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,465 - ERROR - πŸ‘©πŸΌβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,466 - ERROR - πŸ‘©πŸ½β€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,467 - ERROR - πŸ‘©πŸΎβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,468 - ERROR - πŸ‘©πŸΏβ€πŸ¦―β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,477 - ERROR - πŸ§‘β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,477 - ERROR - πŸ§‘πŸ»β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,478 - ERROR - πŸ§‘πŸΌβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,479 - ERROR - πŸ§‘πŸ½β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,480 - ERROR - πŸ§‘πŸΎβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,481 - ERROR - πŸ§‘πŸΏβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,489 - ERROR - πŸ‘¨β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,490 - ERROR - πŸ‘¨πŸ»β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,491 - ERROR - πŸ‘¨πŸΌβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,492 - ERROR - πŸ‘¨πŸ½β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,493 - ERROR - πŸ‘¨πŸΎβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,493 - ERROR - πŸ‘¨πŸΏβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,502 - ERROR - πŸ‘©β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,503 - ERROR - πŸ‘©πŸ»β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,504 - ERROR - πŸ‘©πŸΌβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,505 - ERROR - πŸ‘©πŸ½β€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,506 - ERROR - πŸ‘©πŸΎβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,506 - ERROR - πŸ‘©πŸΏβ€πŸ¦Όβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,520 - ERROR - πŸ§‘β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,521 - ERROR - πŸ§‘πŸ»β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,521 - ERROR - πŸ§‘πŸΌβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,522 - ERROR - πŸ§‘πŸ½β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,523 - ERROR - πŸ§‘πŸΎβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,524 - ERROR - πŸ§‘πŸΏβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,532 - ERROR - πŸ‘¨β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,533 - ERROR - πŸ‘¨πŸ»β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,534 - ERROR - πŸ‘¨πŸΌβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,535 - ERROR - πŸ‘¨πŸ½β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,536 - ERROR - πŸ‘¨πŸΎβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,536 - ERROR - πŸ‘¨πŸΏβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,546 - ERROR - πŸ‘©β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,547 - ERROR - πŸ‘©πŸ»β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,548 - ERROR - πŸ‘©πŸΌβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,548 - ERROR - πŸ‘©πŸ½β€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,549 - ERROR - πŸ‘©πŸΎβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,550 - ERROR - πŸ‘©πŸΏβ€πŸ¦½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,574 - ERROR - πŸƒβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,575 - ERROR - πŸƒπŸ»β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,576 - ERROR - πŸƒπŸΌβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,577 - ERROR - πŸƒπŸ½β€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,578 - ERROR - πŸƒπŸΎβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,578 - ERROR - πŸƒπŸΏβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,579 - ERROR - πŸƒβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,580 - ERROR - πŸƒπŸ»β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,581 - ERROR - πŸƒπŸΌβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,582 - ERROR - πŸƒπŸ½β€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,583 - ERROR - πŸƒπŸΎβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,583 - ERROR - πŸƒπŸΏβ€β™€οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,584 - ERROR - πŸƒβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,585 - ERROR - πŸƒπŸ»β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,586 - ERROR - πŸƒπŸΌβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,587 - ERROR - πŸƒπŸ½β€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,587 - ERROR - πŸƒπŸΎβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
2024-05-24 22:01:22,588 - ERROR - πŸƒπŸΏβ€β™‚οΈβ€βž‘οΈ cannot be transform into an image, unimplemented feature
radarhere commented 5 months ago

I've sent an e-mail to FreeType asking them if they have any thoughts.

Hi, Over at Python Pillow, a user has tried to render an emoji with macOS’ Apple Color Emoji.ttc - https://github.com/python-pillow/Pillow/issues/7854#issuecomment-2128088090. The emoji is the combination of β€˜woman’ U+1F469, 'zero width joiner’ U+200D, 'manual wheelchair’ U+1F9BD, 'zero width joiner’ U+200D, 'black rightwards arrow’ U+27A1, 'variation selector-16’ U+FE0F, with the intention of being a woman in a manual wheelchair facing right. However, FreeType returns an Unimplemented_Feature error. Interesting, it only doesn’t do this for just a woman in a manual wheelchair. To demonstrate, the following code attempts to use woman in a manual wheelchair, and then woman in a manual wheelchair facing right. The error only occurs in the second instance. ```c FT_Library library; FT_Init_FreeType(&library); FT_Face face = NULL; FT_New_Face(library, "/System/Library/Fonts/Apple Color Emoji.ttc", 0, &face); FT_Set_Pixel_Sizes(face, 0, 64); int error = FT_Load_Glyph(face, 1507, FT_LOAD_DEFAULT); if (error) { printf("1507: error %d\n", error); } error = FT_Load_Glyph(face, 1508, FT_LOAD_DEFAULT); if (error) { printf("1508: error %d\n", error); } ``` I’ve attached images that, as far as I can see, show that both indexes are present in the font. Any thoughts as to why one should fail but not the other would be appreciated. Thanks. ![1507](https://github.com/python-pillow/Pillow/assets/3112309/48c84cd5-2705-4c90-90d6-36e867a39b6d) ![1508](https://github.com/python-pillow/Pillow/assets/3112309/33268087-4677-4206-b56c-7f9668e08448)
radarhere commented 5 months ago

I still need to continue the conversation with FreeType, but here is part of the initial response.

Looking at this report it seems that somehow the image should be mirrored horizontally – I guess this is the problem with FreeType.

Please remember that color emoji rendering support within FreeType is very limited and only partially implemented – it is not intended as a general solution but rather as a last resort for people who won't do the color bitmap blitting by themselves.

Rendering support of Emojis is a border case, since FreeType is decidedly not a graphics library.

BenjaminOddou commented 5 months ago

@radarhere Thanks for the update ! I look forward to get a solution. Please, tell me if you need any other information / tests.

radarhere commented 5 months ago

Ok, after some further investigation, I found that the graphic type 'flip' is being used. This is a new feature from Apple (I can't even find documentation about it), and something that FreeType doesn't support yet.

In my e-mails with FreeType, they have said that supporting this feature would be nice, and so I've created https://gitlab.freedesktop.org/freetype/freetype/-/issues/1282

radarhere commented 2 months ago

The FreeType issue has now been resolved. The next step is to wait for a FreeType release.

BenjaminOddou commented 2 months ago

Many thanks for the update @radarhere 😊