#!/bin/bash
 # Desc: Collects .jpg/jpeg files from a Calibre .htmlz file into .cbz files
-# Version: 0.0.1
+# Version: 0.0.2
 
 for fin in ./*.htmlz; do
     (
         dout="${fin%.*}";
         unzip "$fin" -x / -d "$dout";
         pushd "$dout";
-        mapfile -t images < <(cat index.html  | grep -E "(.jpg|.jpeg)" | sed -E -e 's#.+(images/[0-9]+.(jpeg|jpg)).+#\1#');
+        mapfile -t images < <(cat index.html  | grep -E "(.jpg|.jpeg)" | sed -E -e 's#.+(images/[0-9]+.(jpeg|jpg)).+#\1#' | uniq; );
         dout="./output";
         if [[ -d "$dout" ]]; then
             rm -r "$dout";