jfnavarro / st_analysis

A toolset for analysis and visualisation of Spatial Transcriptomics datasets.
Other
18 stars 7 forks source link

st_data_plotter.py PIL.Image.DecompressionBombError #47

Open lili03080317 opened 11 months ago

lili03080317 commented 11 months ago

Hi, When I run python st_data_plotter.py --counts-table-files stdata.tsv --image-files ST_rep1.jpg --outdir /root/home/ --show-genes CASP7,I got a error like this.

Total number of spots 1933 Total number of genes 17138 Number of expressed genes a spot must have to be kept (0.01% of total expressed genes) 193 Dropped 19 spots Removing genes that are expressed in less than 19 spots with a count of at least 1 Dropped 4804 genes Computing per spot normalization... Plotting data... Traceback (most recent call last): File "st_data_plotter.py", line 214, in args.use_log_scale) File "st_data_plotter.py", line 156, in main vmax=vmax) File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/stanalysis-0.5.1-py3.7.egg/stanalysis/visualization.py", line 187, in scatter_plot img = plt.imread(image) File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2158, in imread return matplotlib.image.imread(fname, format) File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/matplotlib/image.py", line 1560, in imread with img_open(fname) as image: File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/PIL/Image.py", line 3277, in open im = _open_core(fp, filename, prefix, formats) File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/PIL/Image.py", line 3264, in _open_core _decompression_bomb_check(im.size) File "/opt/miniconda3/envs/scgpt/lib/python3.7/site-packages/PIL/Image.py", line 3173, in _decompression_bomb_check raise DecompressionBombError(msg) PIL.Image.DecompressionBombError: Image size (251920384 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.

How to fix it?Thank you.

jfnavarro commented 11 months ago

This is a known issue related to the image size limit in matplotlib. There are multiple work-arounds for this.