This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 script.py --source manga.cbr --output comic_folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 script.py --source manga_folder --output comic_folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python3 script.py --source manga_page.jpg --output comic_folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def do_task(base_image, final_output_image_path): | |
if isinstance(base_image, str): | |
base_image = Image.open(base_image) | |
extracted_text = extract_text_from_manga(base_image) | |
base_image = Image.open(base_image) if isinstance(base_image, str) else base_image | |
transparent_image = create_image_with_inverted_text_placement(base_image, extracted_text) | |
overlay_flipped_with_transparent(base_image, transparent_image, final_output_image_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def overlay_flipped_with_transparent(base_image, transparent_image, final_output_image_path='final_output_image.png'): | |
flipped_base_image = base_image.transpose(Image.FLIP_LEFT_RIGHT).convert('RGBA') | |
if transparent_image.mode != 'RGBA': | |
transparent_image = transparent_image.convert('RGBA') | |
combined_image = Image.alpha_composite(flipped_base_image, transparent_image) | |
if final_output_image_path.lower().endswith('.jpg') or final_output_image_path.lower().endswith('.jpeg'): | |
combined_image = combined_image.convert('RGB') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_image_with_inverted_text_placement(base_image, data): | |
width, height = base_image.size | |
new_image = Image.new('RGBA', (width, height), (255, 255, 255, 0)) | |
data = json.loads(data) | |
for index, item in enumerate(data): | |
x, y = item['location'] | |
box_width, box_height = item['width'], item['height'] | |
if box_width <= 0 or box_height <= 0: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import easyocr | |
def extract_text_from_manga(base_image): | |
reader = easyocr.Reader(['en']) | |
if isinstance(base_image, Image.Image): | |
base_image = np.array(base_image) | |
results = reader.readtext(base_image, detail=1) | |
extracted_data = [] | |
for result in results: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useStyles = makeStyles((theme) => ({ | |
seeMore: { | |
color: theme.palette.text.primary, | |
textTransform: 'uppercase', | |
textDecoration: 'inherit', | |
background: 'rgb(0 0 0 / 40%)', | |
padding: '10px 0', | |
textAlign: 'center', | |
position: 'absolute', | |
margin: 'auto', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useLocalStorage(key, initialValue) { | |
const [storedValue, setStoredValue] = useState(() => { | |
try { | |
const item = window.localStorage.getItem(key); | |
return item ? JSON.parse(item) : initialValue; | |
} catch (error) { | |
console.log(error); | |
return initialValue; | |
} | |
}); |
NewerOlder