Added Support for BytesIO as alternate to sending filename and added support to accept a previously processed image data to avoid reprocessing#187
Conversation
…mp data is stored/processed. Check comments for detailed info
…y reprocessing of images. Hash of data dict can also be used to refer to a processed image. Check comments for detailed info
BytesIO addition (bd19403)I was working on images created within a script itself hence needed to pass images without storing in fs, Usage:Reasoning for adding sub_type=touniqueThere is a dictionary FPDF.images which stores the processed data with the name taken from name argument of FPDF.image() as key. |
Reusing processed image data (a35c701)In another use case, I needed to put same image multiple times in multiple pdfs. If I used the BytesIO instace / filename, Usage :Reasoning for adding sub_type=tohashHowever this might need sending the same dict (size of which can go in MBs) and the FPDF.imge() function will always check is this is already present in the dict. If in case you face some random issues, you can try sending a copy.deepcopy of the processedDict or processedDictHash instead of the original variable |
BytesIO instance can now be sent instead of filename
Image data, once processed, can be stored and reused, even in separate instances of FPDF
Please find more details and code example in subsequent comments