crawl4ai
crawl4ai copied to clipboard
Failed to take screenshot: cannot write mode RGBA as JPEG
I use poetry to install crewl4ai with the following version
python = ">=3.11,<3.12"
crawl4ai = {git = "https://github.com/unclecode/crawl4ai.git", extras = ["all"]}
and use the example code to screenshot a demo page and wrap into a fastapi endpoint
class ScreenshotQuery(BaseModel):
url: str
def create_crawler():
crawler = WebCrawler(verbose=True)
crawler.warmup()
return crawler
crawler = create_crawler()
@app.get("/screenshot_website")
def screenshot_website(query: ScreenshotQuery):
result = crawler.run(
url=query.url,
screenshot=True,
bypass_cache=True,
# user_agent="Mozilla/5.0",
)
I got this error
Failed to take screenshot: cannot write mode RGBA as JPEG.
It seems indicates that the image you are trying to save in JPEG format has an alpha channel (transparency), which JPEG does not support.
@memorysaver thx for the report, I am checking it
@memorysaver This is resolved and will be available in version 0.2.76 soon