diff --git a/matrixpack.sh b/matrixpack.sh
index 6be03acb4a94b3410ab093c0d6e6320e8a619784..9d0ad592d8e2e5dd58b420c752ab40d3aaa624b8 100755
--- a/matrixpack.sh
+++ b/matrixpack.sh
@@ -53,8 +53,8 @@ do
       if [ -f "$f" ]; then
 
         # Resizing large images
-        width=$(identify -format "%w" "$f")> /dev/null
-        height=$(identify -format "%h" "$f")> /dev/null
+        width=$(identify -format "%w" "$f"[0])> /dev/null
+        height=$(identify -format "%h" "$f"[0])> /dev/null
         if [ $width -gt 256 ]; then
           width="256";
         fi
@@ -90,8 +90,8 @@ do
 
         # Calculating 128x128> format
         convert "$slug/tmp/$f.$type" -resize "128x128" "$slug/tmp/size"
-        width=$(identify -format "%w" "$slug/tmp/size")> /dev/null
-        height=$(identify -format "%h" "$slug/tmp/size")> /dev/null
+        width=$(identify -format "%w" "$slug/tmp/size"[0])> /dev/null
+        height=$(identify -format "%h" "$slug/tmp/size"[0])> /dev/null
         # Appending to json
         echo -n "{\"body\":\"$f\",\"info\":{\"mimetype\":\"image/$type\",\"h\":$height,\"w\":$width,\"thumbnail_url\":\"$mxc\"},\"msgtype\":\"m.sticker\",\"url\":\"$mxc\",\"id\":\"$packname-$f\"}" >> "$slug/$slug.json"
         first=","