whiplashoo / split-image Goto Github PK
View Code? Open in Web Editor NEWA Python package that lets you quickly split an image into rows and columns (tiles).
License: MIT License
A Python package that lets you quickly split an image into rows and columns (tiles).
License: MIT License
It would be very useful if the script allowed me to reverse the process of splitting by joining the processed tiles back together.
Hi whiplashoo,
Joined image will lost alpha info (was 32 bits, becomes 24 bits after joining).
Works fine with split method: alpha info will be reserved correctly after splitting.
Thank you.
split-image ./Knob333.png 128 1
Exporting image tile: ./Knob333_0.png
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/PIL/ImageFile.py", line 518, in _save
fh = fp.fileno()
AttributeError: '_idat' object has no attribute 'fileno'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/split-image", line 33, in
sys.exit(load_entry_point('split-image==2.0.1', 'console_scripts', 'split-image')())
File "/usr/local/lib/python3.10/site-packages/split_image/split.py", line 173, in main
split_image(image_path, args.rows, args.cols,
File "/usr/local/lib/python3.10/site-packages/split_image/split.py", line 56, in split_image
outp.save(outp_path)
File "/usr/local/lib/python3.10/site-packages/PIL/Image.py", line 2431, in save
save_handler(self, fp, filename)
File "/usr/local/lib/python3.10/site-packages/PIL/PngImagePlugin.py", line 1420, in _save
ImageFile._save(im, _idat(fp, chunk), [("zip", (0, 0) + im.size, 0, rawmode)])
File "/usr/local/lib/python3.10/site-packages/PIL/ImageFile.py", line 522, in _save
_encode_tile(im, fp, tile, bufsize, None, exc)
File "/usr/local/lib/python3.10/site-packages/PIL/ImageFile.py", line 533, in _encode_tile
encoder.setimage(im.im, b)
SystemError: tile cannot extend outside image
OS: Macos 12.6.3
Python:3.10
If you give the program an absolute path, you will end up with a bunch of images in your users folder
Is it normal that the sum of the file sizes of the generated tiles is larger than the file size of the original image by 2x ?
Is there a way to avoid that?
Thanks for the great work on this library
hi whiplashoo,
Great tool,
but it failed to join images if image name already contains underscore symbol _
.
Thank you.
I have tested the code on terminal and the package works as expected and with given example. The only issue so far is that the same code doesn't work on jupyter notebook.
Dear author, thanks for the awesome tool
As title, your sorting function on the string level (line 114) is a bug, shown by the code does not work for more than 10 images (0, 1, 10, 11, ...)
Hi:) I need to slice my images accordingly to some kind of algorithm, so terminal usage is cumbersome.
Is there a way to do it similar to this pseudocode?
from split-image import Slicer
list_of_slices = Slicer('myimage.jpg', rows_num, col_num)
Anyway to batch process/split images? Saving splits to a different directory?
Maybe there is an easy way to do this already by piping filenames to "split-image"?
Thanks!
Batch processing multiple images
Set a custom output directory
Hello
I want to split an image and place the result in a Split directory.
My script
import cv2
from split_image import split_image
split_image("Eau1_gray.jpg",1,8, False, False, |'Split'])
cv2.waitKey(0)
cv2.destroyAllWindows()
do not work. Split is OK but in the current directory
this doesn't seem to support the image orientation (rotation?) tag in images, at least on windows
so for example, using canon camera, turning the camera to take a vertical image -- the image looks ok within windows and image apps, but when running split on it, the source image is obviously taken as landscape instead of portrait orientation and hence the resulting pieces don't match expectations
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.