ImageMagick not processing all PNG files when converting to PDF - imagemagick

I have a PDF file with some pages being incorrectly oriented. I am trying to fix this and to do so, extracting all images as PNG (lossless), fix orientation and re-create a PDF.
To do this, I ran the pdfimages command:
pdfimages -png test.pdf foo
Which generated 240 or so of PNG files, named like foo-000.png and so on. Everything seems good.
However, when I run:
convert -quality 100 *.png new.pdf
The resulting new.pdf file only contains 55 pages out of 240. Could anyone advise why this might be? I don't see any obvious errors on the screen and I don't quite understand why it doesn't process all PNG files, all sitting in the same directory and numbered in sequence. Thank you.
Edit: Addressing comments from #fmw42:
foo-000.png PNG 811x1369 811x1369+0+0 8-bit sRGB 863037B 0.000u 0:00.000
foo-001.png PNG 1660x2741 1660x2741+0+0 8-bit Gray 2c 15779B 0.000u 0:00.000
foo-002.png PNG 1662x2743 1662x2743+0+0 8-bit Gray 2c 32586B 0.000u 0:00.000
foo-003.png PNG 1652x2743 1652x2743+0+0 8-bit Gray 2c 34658B 0.000u 0:00.000
foo-004.png PNG 1660x2743 1660x2743+0+0 8-bit Gray 2c 16886B 0.000u 0:00.000
foo-005.png PNG 1654x2735 1654x2735+0+0 8-bit Gray 2c 57090B 0.000u 0:00.000
foo-006.png PNG 1658x2745 1658x2745+0+0 8-bit Gray 2c 4036B 0.000u 0:00.000
foo-007.png PNG 1658x2743 1658x2743+0+0 8-bit Gray 2c 33787B 0.000u 0:00.000
foo-008.png PNG 2740x1649 2740x1649+0+0 8-bit Gray 2c 61294B 0.000u 0:00.000
foo-009.png PNG 826x1372 826x1372+0+0 8-bit Gray 256c 308314B 0.000u 0:00.000
foo-010.png PNG 2742x1649 2742x1649+0+0 8-bit Gray 2c 58647B 0.000u 0:00.000
foo-011.png PNG 1658x2745 1658x2745+0+0 8-bit Gray 2c 61920B 0.000u 0:00.000
foo-012.png PNG 2740x1649 2740x1649+0+0 8-bit Gray 2c 62151B 0.000u 0:00.000
foo-013.png PNG 1650x2743 1650x2743+0+0 8-bit Gray 2c 57237B 0.000u 0:00.000
foo-014.png PNG 2740x1649 2740x1649+0+0 8-bit Gray 2c 67751B 0.000u 0:00.000
foo-015.png PNG 2742x1649 2742x1649+0+0 8-bit Gray 2c 62368B 0.000u 0:00.000
foo-016.png PNG 2738x1645 2738x1645+0+0 8-bit Gray 2c 59511B 0.000u 0:00.000
foo-017.png PNG 1646x2745 1646x2745+0+0 8-bit Gray 2c 63359B 0.000u 0:00.000
foo-018.png PNG 2742x1645 2742x1645+0+0 8-bit Gray 2c 65173B 0.000u 0:00.000
foo-019.png PNG 1640x2745 1640x2745+0+0 8-bit Gray 2c 63532B 0.000u 0:00.000
foo-020.png PNG 2740x1641 2740x1641+0+0 8-bit Gray 2c 62590B 0.000u 0:00.000
foo-021.png PNG 1642x2745 1642x2745+0+0 8-bit Gray 2c 70618B 0.000u 0:00.000
foo-022.png PNG 1640x2737 1640x2737+0+0 8-bit Gray 2c 62976B 0.000u 0:00.000
foo-023.png PNG 1642x2743 1642x2743+0+0 8-bit Gray 2c 63677B 0.000u 0:00.000
foo-024.png PNG 2740x1631 2740x1631+0+0 8-bit Gray 2c 63156B 0.000u 0:00.000
foo-025.png PNG 819x1371 819x1371+0+0 8-bit Gray 256c 280669B 0.000u 0:00.000
foo-026.png PNG 2738x1631 2738x1631+0+0 8-bit Gray 2c 60419B 0.000u 0:00.000
foo-027.png PNG 2744x1659 2744x1659+0+0 8-bit Gray 2c 64470B 0.000u 0:00.000
foo-028.png PNG 2740x1655 2740x1655+0+0 8-bit Gray 2c 56055B 0.000u 0:00.000
foo-029.png PNG 2748x1653 2748x1653+0+0 8-bit Gray 2c 61986B 0.000u 0:00.000
foo-030.png PNG 2744x1653 2744x1653+0+0 8-bit Gray 2c 62517B 0.000u 0:00.000
foo-031.png PNG 2732x1659 2732x1659+0+0 8-bit Gray 2c 60172B 0.000u 0:00.000
foo-032.png PNG 2730x1655 2730x1655+0+0 8-bit Gray 2c 65304B 0.000u 0:00.000
foo-033.png PNG 828x1368 828x1368+0+0 8-bit Gray 256c 308276B 0.000u 0:00.000
foo-034.png PNG 2736x1657 2736x1657+0+0 8-bit Gray 2c 55901B 0.000u 0:00.000
foo-035.png PNG 2734x1659 2734x1659+0+0 8-bit Gray 2c 64016B 0.000u 0:00.000
foo-036.png PNG 2728x1653 2728x1653+0+0 8-bit Gray 2c 66712B 0.000u 0:00.000
foo-037.png PNG 1656x2731 1656x2731+0+0 8-bit Gray 2c 29590B 0.000u 0:00.000
foo-038.png PNG 1658x2727 1658x2727+0+0 8-bit Gray 2c 35067B 0.000u 0:00.000
foo-039.png PNG 2746x1659 2746x1659+0+0 8-bit Gray 2c 66504B 0.000u 0:00.000
foo-040.png PNG 2738x1651 2738x1651+0+0 8-bit Gray 2c 66758B 0.000u 0:00.000
foo-041.png PNG 2746x1657 2746x1657+0+0 8-bit Gray 2c 59626B 0.000u 0:00.000
foo-042.png PNG 1656x2739 1656x2739+0+0 8-bit Gray 2c 57147B 0.000u 0:00.000
foo-043.png PNG 2748x1655 2748x1655+0+0 8-bit Gray 2c 65837B 0.000u 0:00.000
foo-044.png PNG 1644x2739 1644x2739+0+0 8-bit Gray 2c 68070B 0.000u 0:00.000
foo-045.png PNG 2750x1649 2750x1649+0+0 8-bit Gray 2c 53961B 0.000u 0:00.000
foo-046.png PNG 2742x1639 2742x1639+0+0 8-bit Gray 2c 64328B 0.000u 0:00.000
foo-047.png PNG 2748x1653 2748x1653+0+0 8-bit Gray 2c 70157B 0.000u 0:00.000
foo-048.png PNG 821x1373 821x1373+0+0 8-bit sRGB 632860B 0.000u 0:00.000
foo-049.png PNG 826x1374 826x1374+0+0 8-bit sRGB 816354B 0.000u 0:00.000
foo-050.png PNG 820x1373 820x1373+0+0 8-bit sRGB 851163B 0.000u 0:00.000
foo-051.png PNG 1650x2747 1650x2747+0+0 8-bit Gray 2c 59971B 0.000u 0:00.000
foo-052.png PNG 820x1372 820x1372+0+0 8-bit sRGB 797013B 0.000u 0:00.000
foo-053.png PNG 1652x2747 1652x2747+0+0 8-bit Gray 2c 67124B 0.000u 0:00.000
foo-054.png PNG 819x1373 819x1373+0+0 8-bit sRGB 812509B 0.000u 0:00.000
foo-055.png PNG 826x1374 826x1374+0+0 8-bit sRGB 768898B 0.000u 0:00.000
foo-056.png PNG 817x1372 817x1372+0+0 8-bit sRGB 645606B 0.000u 0:00.000
foo-057.png PNG 1653x2748 1653x2748+0+0 8-bit sRGB 134735B 0.000u 0:00.000
foo-058.png PNG 821x1371 821x1371+0+0 8-bit sRGB 764537B 0.000u 0:00.000
foo-059.png PNG 824x1373 824x1373+0+0 8-bit sRGB 824632B 0.000u 0:00.000
foo-060.png PNG 821x1370 821x1370+0+0 8-bit sRGB 650050B 0.000u 0:00.000
foo-061.png PNG 823x1374 823x1374+0+0 8-bit sRGB 766561B 0.000u 0:00.000
foo-062.png PNG 818x1370 818x1370+0+0 8-bit sRGB 716083B 0.000u 0:00.000
foo-063.png PNG 830x1372 830x1372+0+0 8-bit sRGB 744148B 0.000u 0:00.000
foo-064.png PNG 2742x1655 2742x1655+0+0 8-bit Gray 2c 66396B 0.000u 0:00.000
foo-065.png PNG 2742x1661 2742x1661+0+0 8-bit Gray 2c 68816B 0.000u 0:00.000
foo-066.png PNG 1656x2737 1656x2737+0+0 8-bit Gray 2c 41455B 0.000u 0:00.000
foo-067.png PNG 1660x2743 1660x2743+0+0 8-bit Gray 2c 32537B 0.000u 0:00.000
foo-068.png PNG 2740x1657 2740x1657+0+0 8-bit Gray 2c 64692B 0.000u 0:00.000
foo-069.png PNG 1668x2745 1668x2745+0+0 8-bit Gray 2c 68550B 0.000u 0:00.000
foo-070.png PNG 2740x1655 2740x1655+0+0 8-bit Gray 2c 62729B 0.000u 0:00.000
foo-071.png PNG 2742x1667 2742x1667+0+0 8-bit Gray 2c 56160B 0.000u 0:00.000
foo-072.png PNG 829x1371 829x1371+0+0 8-bit sRGB 797036B 0.000u 0:00.000
foo-073.png PNG 834x1374 834x1374+0+0 8-bit sRGB 775010B 0.000u 0:00.000
foo-074.png PNG 828x1370 828x1370+0+0 8-bit sRGB 851987B 0.000u 0:00.000
foo-075.png PNG 2746x1665 2746x1665+0+0 8-bit Gray 2c 58976B 0.000u 0:00.000
foo-076.png PNG 2742x1655 2742x1655+0+0 8-bit Gray 2c 69594B 0.000u 0:00.000
foo-077.png PNG 833x1373 833x1373+0+0 8-bit sRGB 781652B 0.000u 0:00.000
foo-078.png PNG 827x1372 827x1372+0+0 8-bit sRGB 662858B 0.000u 0:00.000
foo-079.png PNG 831x1376 831x1376+0+0 8-bit sRGB 784349B 0.000u 0:00.000
foo-080.png PNG 825x1372 825x1372+0+0 8-bit sRGB 862631B 0.000u 0:00.000
foo-081.png PNG 832x1375 832x1375+0+0 8-bit Gray 256c 299839B 0.000u 0:00.000
foo-082.png PNG 823x1373 823x1373+0+0 8-bit sRGB 930388B 0.000u 0:00.000
foo-083.png PNG 830x1372 830x1372+0+0 8-bit sRGB 713801B 0.000u 0:00.000
foo-084.png PNG 2742x1647 2742x1647+0+0 8-bit Gray 2c 66628B 0.000u 0:00.000
foo-085.png PNG 828x1374 828x1374+0+0 8-bit sRGB 691227B 0.000u 0:00.000
foo-086.png PNG 2740x1645 2740x1645+0+0 8-bit Gray 2c 61786B 0.000u 0:00.000
foo-087.png PNG 827x1374 827x1374+0+0 8-bit sRGB 736898B 0.000u 0:00.000
foo-088.png PNG 823x1370 823x1370+0+0 8-bit sRGB 737153B 0.000u 0:00.000
foo-089.png PNG 2746x1653 2746x1653+0+0 8-bit Gray 2c 60026B 0.000u 0:00.000
foo-090.png PNG 2742x1645 2742x1645+0+0 8-bit Gray 2c 61806B 0.000u 0:00.000
foo-091.png PNG 1656x2745 1656x2745+0+0 8-bit Gray 2c 11639B 0.000u 0:00.000
foo-092.png PNG 2744x1645 2744x1645+0+0 8-bit Gray 2c 33051B 0.000u 0:00.000
foo-093.png PNG 1656x2749 1656x2749+0+0 8-bit Gray 2c 63322B 0.000u 0:00.000
foo-094.png PNG 822x1371 822x1371+0+0 8-bit sRGB 630895B 0.000u 0:00.000
foo-095.png PNG 830x1372 830x1372+0+0 8-bit sRGB 781857B 0.000u 0:00.000
foo-096.png PNG 2736x1641 2736x1641+0+0 8-bit Gray 2c 62180B 0.000u 0:00.000
foo-097.png PNG 2744x1653 2744x1653+0+0 8-bit Gray 2c 61320B 0.000u 0:00.000
foo-098.png PNG 2742x1641 2742x1641+0+0 8-bit Gray 2c 55956B 0.000u 0:00.000
foo-099.png PNG 826x1371 826x1371+0+0 8-bit sRGB 716384B 0.000u 0:00.000
foo-100.png PNG 1642x2735 1642x2735+0+0 8-bit Gray 2c 56603B 0.000u 0:00.000
foo-101.png PNG 2738x1647 2738x1647+0+0 8-bit Gray 2c 61265B 0.000u 0:00.000
foo-102.png PNG 2734x1637 2734x1637+0+0 8-bit Gray 2c 61491B 0.000u 0:00.000
foo-103.png PNG 2742x1651 2742x1651+0+0 8-bit Gray 2c 64134B 0.000u 0:00.000
foo-104.png PNG 2736x1645 2736x1645+0+0 8-bit Gray 2c 63315B 0.000u 0:00.000
foo-105.png PNG 2748x1651 2748x1651+0+0 8-bit Gray 2c 58804B 0.000u 0:00.000
foo-106.png PNG 2746x1641 2746x1641+0+0 8-bit Gray 2c 54907B 0.000u 0:00.000
foo-107.png PNG 2744x1649 2744x1649+0+0 8-bit Gray 2c 54446B 0.000u 0:00.000
foo-108.png PNG 820x1370 820x1370+0+0 8-bit sRGB 699744B 0.000u 0:00.000
foo-109.png PNG 2748x1651 2748x1651+0+0 8-bit Gray 2c 56913B 0.000u 0:00.000
foo-110.png PNG 2744x1639 2744x1639+0+0 8-bit Gray 2c 62408B 0.000u 0:00.000
foo-111.png PNG 826x1373 826x1373+0+0 8-bit sRGB 705947B 0.000u 0:00.000
foo-112.png PNG 2740x1643 2740x1643+0+0 8-bit Gray 2c 54017B 0.000u 0:00.000
foo-113.png PNG 2740x1645 2740x1645+0+0 8-bit Gray 2c 62005B 0.000u 0:00.000
foo-114.png PNG 822x1372 822x1372+0+0 8-bit sRGB 626748B 0.000u 0:00.000
foo-115.png PNG 824x1372 824x1372+0+0 8-bit sRGB 804754B 0.000u 0:00.000
foo-116.png PNG 2740x1643 2740x1643+0+0 8-bit Gray 2c 58537B 0.000u 0:00.000
foo-117.png PNG 2744x1649 2744x1649+0+0 8-bit Gray 2c 60881B 0.000u 0:00.000
foo-118.png PNG 2742x1641 2742x1641+0+0 8-bit Gray 2c 66037B 0.000u 0:00.000
foo-119.png PNG 1652x2741 1652x2741+0+0 8-bit Gray 2c 22642B 0.000u 0:00.000
foo-120.png PNG 817x1368 817x1368+0+0 8-bit sRGB 423405B 0.000u 0:00.000
foo-121.png PNG 2744x1643 2744x1643+0+0 8-bit Gray 2c 58476B 0.000u 0:00.000
foo-122.png PNG 820x1369 820x1369+0+0 8-bit sRGB 799003B 0.000u 0:00.000
foo-123.png PNG 2742x1647 2742x1647+0+0 8-bit Gray 2c 59131B 0.000u 0:00.009
foo-124.png PNG 820x1368 820x1368+0+0 8-bit sRGB 811468B 0.000u 0:00.000
foo-125.png PNG 820x1372 820x1372+0+0 8-bit sRGB 832165B 0.000u 0:00.000
foo-126.png PNG 2738x1631 2738x1631+0+0 8-bit Gray 2c 51623B 0.000u 0:00.000
foo-127.png PNG 818x1372 818x1372+0+0 8-bit sRGB 760412B 0.000u 0:00.000
foo-128.png PNG 814x1368 814x1368+0+0 8-bit sRGB 804751B 0.000u 0:00.000
foo-129.png PNG 838x1374 838x1374+0+0 8-bit sRGB 725536B 0.000u 0:00.000
foo-130.png PNG 833x1370 833x1370+0+0 8-bit sRGB 761275B 0.000u 0:00.000
foo-131.png PNG 2746x1679 2746x1679+0+0 8-bit Gray 2c 61851B 0.000u 0:00.000
foo-132.png PNG 2738x1667 2738x1667+0+0 8-bit Gray 2c 62108B 0.000u 0:00.000
foo-133.png PNG 2746x1681 2746x1681+0+0 8-bit Gray 2c 64475B 0.000u 0:00.000
foo-134.png PNG 2742x1671 2742x1671+0+0 8-bit Gray 2c 53838B 0.000u 0:00.000
foo-135.png PNG 2740x1675 2740x1675+0+0 8-bit Gray 2c 67007B 0.000u 0:00.000
foo-136.png PNG 832x1368 832x1368+0+0 8-bit sRGB 778577B 0.000u 0:00.000
foo-137.png PNG 2744x1675 2744x1675+0+0 8-bit Gray 2c 55701B 0.000u 0:00.000
foo-138.png PNG 832x1369 832x1369+0+0 8-bit sRGB 775769B 0.000u 0:00.000
foo-139.png PNG 2744x1681 2744x1681+0+0 8-bit Gray 2c 62509B 0.000u 0:00.000
foo-140.png PNG 1670x2741 1670x2741+0+0 8-bit Gray 2c 64326B 0.000u 0:00.000
foo-141.png PNG 2744x1679 2744x1679+0+0 8-bit Gray 2c 59943B 0.000u 0:00.000
foo-142.png PNG 835x1370 835x1370+0+0 8-bit sRGB 767414B 0.000u 0:00.000
foo-143.png PNG 1684x2727 1684x2727+0+0 8-bit Gray 2c 63949B 0.000u 0:00.000
foo-144.png PNG 2720x1673 2720x1673+0+0 8-bit Gray 2c 65629B 0.000u 0:00.000
foo-145.png PNG 1680x2729 1680x2729+0+0 8-bit Gray 2c 66209B 0.000u 0:00.000
foo-146.png PNG 2722x1669 2722x1669+0+0 8-bit Gray 2c 65949B 0.000u 0:00.000
foo-147.png PNG 1670x2733 1670x2733+0+0 8-bit Gray 2c 55531B 0.000u 0:00.000
foo-148.png PNG 832x1365 832x1365+0+0 8-bit sRGB 693593B 0.000u 0:00.000
foo-149.png PNG 835x1369 835x1369+0+0 8-bit sRGB 736226B 0.000u 0:00.000
foo-150.png PNG 2736x1663 2736x1663+0+0 8-bit Gray 2c 56517B 0.000u 0:00.000
foo-151.png PNG 834x1363 834x1363+0+0 8-bit sRGB 797981B 0.000u 0:00.000
foo-152.png PNG 832x1363 832x1363+0+0 8-bit sRGB 746904B 0.000u 0:00.000
foo-153.png PNG 837x1369 837x1369+0+0 8-bit sRGB 739076B 0.000u 0:00.000
foo-154.png PNG 2730x1663 2730x1663+0+0 8-bit Gray 2c 66874B 0.000u 0:00.000
foo-155.png PNG 838x1368 838x1368+0+0 8-bit sRGB 789193B 0.000u 0:00.000
foo-156.png PNG 834x1366 834x1366+0+0 8-bit sRGB 854017B 0.000u 0:00.000
foo-157.png PNG 835x1369 835x1369+0+0 8-bit sRGB 113263B 0.000u 0:00.000
foo-158.png PNG 1662x2733 1662x2733+0+0 8-bit Gray 2c 34563B 0.000u 0:00.000
foo-159.png PNG 833x1376 833x1376+0+0 8-bit Gray 256c 365802B 0.000u 0:00.000
foo-160.png PNG 831x1373 831x1373+0+0 8-bit sRGB 782775B 0.000u 0:00.000
foo-161.png PNG 835x1375 835x1375+0+0 8-bit sRGB 783695B 0.000u 0:00.000
foo-162.png PNG 2750x1663 2750x1663+0+0 8-bit Gray 2c 65274B 0.000u 0:00.000
foo-163.png PNG 832x1375 832x1375+0+0 8-bit sRGB 801005B 0.000u 0:00.000
foo-164.png PNG 2744x1651 2744x1651+0+0 8-bit Gray 2c 59873B 0.000u 0:00.000
foo-165.png PNG 2746x1663 2746x1663+0+0 8-bit Gray 2c 58454B 0.000u 0:00.000
foo-166.png PNG 2746x1653 2746x1653+0+0 8-bit Gray 2c 63340B 0.000u 0:00.000
foo-167.png PNG 2748x1663 2748x1663+0+0 8-bit Gray 2c 61988B 0.000u 0:00.000
foo-168.png PNG 1656x2743 1656x2743+0+0 8-bit Gray 2c 67475B 0.000u 0:00.000
foo-169.png PNG 2752x1665 2752x1665+0+0 8-bit Gray 2c 58072B 0.000u 0:00.000
foo-170.png PNG 2744x1659 2744x1659+0+0 8-bit Gray 2c 58085B 0.000u 0:00.000
foo-171.png PNG 834x1374 834x1374+0+0 8-bit Gray 256c 301269B 0.000u 0:00.000
foo-172.png PNG 2742x1661 2742x1661+0+0 8-bit Gray 2c 51158B 0.000u 0:00.000
foo-173.png PNG 2744x1667 2744x1667+0+0 8-bit Gray 2c 61434B 0.000u 0:00.000
foo-174.png PNG 830x1370 830x1370+0+0 8-bit sRGB 792927B 0.000u 0:00.000
foo-175.png PNG 834x1372 834x1372+0+0 8-bit sRGB 605049B 0.000u 0:00.000
foo-176.png PNG 831x1370 831x1370+0+0 8-bit sRGB 736585B 0.000u 0:00.000
foo-177.png PNG 833x1374 833x1374+0+0 8-bit sRGB 721604B 0.000u 0:00.000
foo-178.png PNG 2740x1657 2740x1657+0+0 8-bit Gray 2c 61861B 0.000u 0:00.000
foo-179.png PNG 828x1375 828x1375+0+0 8-bit sRGB 766558B 0.000u 0:00.000
foo-180.png PNG 2746x1647 2746x1647+0+0 8-bit Gray 2c 64992B 0.000u 0:00.000
foo-181.png PNG 2746x1651 2746x1651+0+0 8-bit Gray 2c 46493B 0.000u 0:00.000
foo-182.png PNG 1646x2739 1646x2739+0+0 8-bit Gray 2c 70466B 0.000u 0:00.000
foo-183.png PNG 826x1371 826x1371+0+0 8-bit sRGB 804529B 0.000u 0:00.000
foo-184.png PNG 822x1369 822x1369+0+0 8-bit sRGB 818013B 0.000u 0:00.000
foo-185.png PNG 2756x1675 2756x1675+0+0 8-bit Gray 2c 54018B 0.000u 0:00.000
foo-186.png PNG 2740x1663 2740x1663+0+0 8-bit Gray 2c 65342B 0.000u 0:00.000
foo-187.png PNG 2748x1673 2748x1673+0+0 8-bit Gray 2c 51015B 0.000u 0:00.000
foo-188.png PNG 833x1373 833x1373+0+0 8-bit sRGB 733421B 0.000u 0:00.000
foo-189.png PNG 837x1373 837x1373+0+0 8-bit sRGB 786749B 0.000u 0:00.000
foo-190.png PNG 831x1373 831x1373+0+0 8-bit sRGB 519091B 0.000u 0:00.000
foo-191.png PNG 1676x2745 1676x2745+0+0 8-bit Gray 2c 35346B 0.000u 0:00.000
foo-192.png PNG 1668x2739 1668x2739+0+0 8-bit Gray 2c 57454B 0.000u 0:00.000
foo-193.png PNG 839x1374 839x1374+0+0 8-bit Gray 256c 299936B 0.000u 0:00.000
foo-194.png PNG 2744x1669 2744x1669+0+0 8-bit Gray 2c 56614B 0.000u 0:00.000
foo-195.png PNG 2750x1671 2750x1671+0+0 8-bit Gray 2c 56848B 0.000u 0:00.000
foo-196.png PNG 2746x1667 2746x1667+0+0 8-bit Gray 2c 63438B 0.000u 0:00.000
foo-197.png PNG 1674x2743 1674x2743+0+0 8-bit Gray 2c 64047B 0.000u 0:00.000
foo-198.png PNG 2742x1673 2742x1673+0+0 8-bit Gray 2c 62506B 0.000u 0:00.000
foo-199.png PNG 1670x2743 1670x2743+0+0 8-bit Gray 2c 61062B 0.000u 0:00.000
foo-200.png PNG 2738x1661 2738x1661+0+0 8-bit Gray 2c 52721B 0.000u 0:00.000
foo-201.png PNG 2752x1661 2752x1661+0+0 8-bit Gray 2c 63526B 0.000u 0:00.000
foo-202.png PNG 1652x2745 1652x2745+0+0 8-bit Gray 2c 58859B 0.000u 0:00.000
foo-203.png PNG 2744x1659 2744x1659+0+0 8-bit Gray 2c 55740B 0.000u 0:00.000
foo-204.png PNG 2740x1653 2740x1653+0+0 8-bit Gray 2c 52060B 0.000u 0:00.000
foo-205.png PNG 2748x1661 2748x1661+0+0 8-bit Gray 2c 65644B 0.000u 0:00.000
foo-206.png PNG 2746x1649 2746x1649+0+0 8-bit Gray 2c 56020B 0.000u 0:00.000
foo-207.png PNG 2750x1657 2750x1657+0+0 8-bit Gray 2c 53848B 0.000u 0:00.000
foo-208.png PNG 2744x1649 2744x1649+0+0 8-bit Gray 2c 63891B 0.000u 0:00.000
foo-209.png PNG 2752x1661 2752x1661+0+0 8-bit Gray 2c 52842B 0.000u 0:00.000
foo-210.png PNG 2746x1657 2746x1657+0+0 8-bit Gray 2c 50461B 0.000u 0:00.000
foo-211.png PNG 1654x2743 1654x2743+0+0 8-bit Gray 2c 69020B 0.000u 0:00.000
foo-212.png PNG 1650x2739 1650x2739+0+0 8-bit Gray 2c 61207B 0.000u 0:00.000
foo-213.png PNG 2744x1655 2744x1655+0+0 8-bit Gray 2c 48930B 0.000u 0:00.000
foo-214.png PNG 2740x1649 2740x1649+0+0 8-bit Gray 2c 57365B 0.000u 0:00.000
foo-215.png PNG 2748x1659 2748x1659+0+0 8-bit Gray 2c 65895B 0.000u 0:00.000
foo-216.png PNG 1650x2739 1650x2739+0+0 8-bit Gray 2c 65981B 0.000u 0:00.000
foo-217.png PNG 828x1373 828x1373+0+0 8-bit sRGB 706122B 0.000u 0:00.000
foo-218.png PNG 2736x1647 2736x1647+0+0 8-bit Gray 2c 62707B 0.000u 0:00.000
foo-219.png PNG 829x1372 829x1372+0+0 8-bit sRGB 766365B 0.000u 0:00.000
foo-220.png PNG 2738x1651 2738x1651+0+0 8-bit Gray 2c 56923B 0.000u 0:00.000
foo-221.png PNG 830x1371 830x1371+0+0 8-bit sRGB 796760B 0.000u 0:00.000
foo-222.png PNG 826x1368 826x1368+0+0 8-bit sRGB 781198B 0.000u 0:00.000
foo-223.png PNG 812x1371 812x1371+0+0 8-bit sRGB 219483B 0.000u 0:00.000
foo-224.png PNG 2740x1613 2740x1613+0+0 8-bit Gray 2c 39022B 0.000u 0:00.000
foo-225.png PNG 1628x2747 1628x2747+0+0 8-bit Gray 2c 71429B 0.000u 0:00.000
foo-226.png PNG 1620x2743 1620x2743+0+0 8-bit Gray 2c 51757B 0.000u 0:00.000
foo-227.png PNG 2750x1631 2750x1631+0+0 8-bit Gray 2c 40692B 0.000u 0:00.000
foo-228.png PNG 2740x1621 2740x1621+0+0 8-bit Gray 2c 52903B 0.000u 0:00.000
foo-229.png PNG 2746x1635 2746x1635+0+0 8-bit Gray 2c 22393B 0.000u 0:00.000
foo-230.png PNG 2742x1621 2742x1621+0+0 8-bit Gray 2c 49420B 0.000u 0:00.000
foo-231.png PNG 2742x1635 2742x1635+0+0 8-bit Gray 2c 39622B 0.000u 0:00.000
foo-232.png PNG 1638x2745 1638x2745+0+0 8-bit Gray 2c 30549B 0.000u 0:00.000
foo-233.png PNG 2738x1627 2738x1627+0+0 8-bit Gray 2c 63849B 0.000u 0:00.000
foo-234.png PNG 2744x1643 2744x1643+0+0 8-bit Gray 2c 40637B 0.000u 0:00.000
foo-235.png PNG 1636x2739 1636x2739+0+0 8-bit Gray 2c 42418B 0.000u 0:00.000
foo-236.png PNG 2744x1641 2744x1641+0+0 8-bit Gray 2c 40148B 0.000u 0:00.000
foo-237.png PNG 1638x2737 1638x2737+0+0 8-bit Gray 2c 44867B 0.000u 0:00.000
foo-238.png PNG 1642x2741 1642x2741+0+0 8-bit Gray 2c 11059B 0.000u 0:00.000
I also ran convert with -debug and here is where it seems to go south:
$ convert -debug "Cache,Blob" *.png abc.pdf
# looks OK up to foo-056.png
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/WritePixelCachePixels/5979/Cache
foo-056.png[0][817x1+0+1352]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/ReadPixelCachePixels/4905/Cache
foo-056.png[0][817x1+0+1365]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/WritePixelCachePixels/5979/Cache
foo-056.png[0][817x1+0+1365]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/ReadPixelCachePixels/4905/Cache
foo-056.png[0][817x1+0+1371]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/WritePixelCachePixels/5979/Cache
foo-056.png[0][817x1+0+1371]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy foo-057.png[0]
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Blob convert-im6.q16[33220]: blob.c/OpenBlob/2766/Blob
read 3 magic header bytes
2020-08-26T09:35:38-07:00 0:02.610 4.630u 6.9.10 Cache convert-im6.q16[33220]: cache.c/DestroyPixelCache/1182/Cache
destroy foo-058.png[0]
What's interesting is, I also tried creating a PDF by deleting the first 60 images or so. The new PDF grabbed 72 pages this time, once again creating a different incomplete PDF file.

Solution:
Per #fmw42's suggestion, I bumped these settings in /etc/ImageMagick-6/policy.xml to 2GiB then noticed that the resulting PDF contained more pages. I kept on bumping the value until I see all the pages.
<policy domain="resource" name="memory" value="4GiB"/>
<policy domain="resource" name="map" value="4GiB"/>
<policy domain="resource" name="width" value="16KP"/>
<policy domain="resource" name="height" value="16KP"/>
<!-- <policy domain="resource" name="list-length" value="128"/> -->
<policy domain="resource" name="area" value="4GiB"/>
<policy domain="resource" name="disk" value="4GiB"/>

Related

How to enlarge into PNG no less than a height of 2880, but proportions must be sustained and maintained?

My special requirements are,
When their height is 2879 or below, enlarge into 2880
When their height is 2881 or over, leave alone
Always sustain and maintain their proportion
Everything must be converted into PNG in a full quality, no matters if the source picture is PNG or JPG
Those are my photographes to be enlarged for use as my own UEFI wallpapers on an 5k screen
PNG source pictures to be overwritten by the results
JPG source pictures to be removed after the final completion
Finally, i’m unsure if those below commands are correct for doing everything above,
for J in *.jpeg; do ls */*|grep jpeg|xargs -I $J mogrify $J -gemoetry x2880< -quality 100% $J.png; done
for j in *.jpg; do ls */*|grep jpg|xargs -I $j mogrify $j -gemoetry x2880< -quality 100% $j.png; done
for K in *.JPEG; do ls */*|grep JPEG|xargs -I $K mogrify $K -gemoetry x2880< -quality 100% $K.png; done
for k in *.JPG; do ls */*|grep JPG|xargs -I $k mogrify $k -gemoetry x2880< -quality 100% $k.png; done
find ./ -type f -iname "*.JPEG" -exec mogrify -format png -layers Dispose -gemoetry x2880< -quality 100% {} +
find ./ -type f -iname "*.JPG" -exec mogrify -format png -layers Dispose -gemoetry x2880< -quality 100% {} +
find ./ -type f -iname "*.jpeg" -exec mogrify -format png -layers Dispose -gemoetry x2880< -quality 100% {} +
find ./ -type f -iname "*.jpg" -exec mogrify -format png -layers Dispose -gemoetry x2880< -quality 100% {} +
Thanks answering anyway, i appreciate every people’s effort :)

Convert PDF to Image(s) with different resolution using ImageMagick

I have to convert the pdf file (with more text) to images with different resolution.
I am executing the following commands:
width:1024px
convert -density 150 -antialias -resize 1024x -quality 80 "${inputFilePath}" "${outputFilePath}"
width:720px
convert -density 150 -antialias -resize 720x -quality 80 "${inputFilePath}" "${outputFilePath}"
width:320px
convert -density 150 -antialias -resize 320x -quality 80 "${inputFilePath}" "${outputFilePath}"
The generated images are not clear.
Can you help me to understand what I have to change?
Thanks in advance.
Increase your density to get better quality. -antialias will not help in your ImageMagick command. It is only used when adding new text. Put the density after convert and then put the input. Put your quality after the input and before the output. Use parenthesis processing with clones to generate all 3 results in one convert command.
convert -density 300 input \
\( -clone 0 -resize 1024x -quality 80 +write output1 \) \
\( -clone 0 -resize 720x -quality 80 +write output2 \) \
\( -clone 0 -resize 320x -quality 80 +write output3 \) \
null:

Bold Table Bars Removal using ImageMagick

I have an Invoice Image which contains table bars as below example.
I am using ImageMagick to pre-process Images using the below command.
convert 0.png -type Grayscale -negate -define morphology:compose=darken -morphology Thinning 'Rectangle:1x80+0+0<' -negate 0.png
My Problem is that output with horizontal bold bars. ImageMagick fails to convert it correctly and output as below.
What can I do to solve this?
Here is a different way using ImageMagick and connected components. First trim the image to remove the outer white, then use connected components to get the id of the largest black region, which should be id=0. The run it again removing the id of the largest area making it transparent and finally flattening the result against white. Then add the thinning operation to remove the horizontal lines that were not fully black. See https://imagemagick.org/script/connected-components.php
convert image.png -fuzz 5% -trim +repage \
-bordercolor black -border 1 \
-define connected-components:verbose=true \
-define connected-components:mean-color=true \
-connected-components 4 \
null:
Objects (id: bounding-box centroid area mean-color):
0: 953x205+0+0 478.7,65.6 31513 srgba(0,0,0,1)
10789: 943x19+5+184 488.4,193.1 16885 srgba(255,255,255,1)
1: 465x17+5+1 237.0,9.0 7905 srgba(255,255,255,1)
2: 474x17+474+1 733.5,9.0 7096 srgba(255,255,255,1)
3820: 281x21+667+67 807.0,76.9 5609 srgba(255,255,255,1)
5195: 281x21+667+90 807.0,99.9 5609 srgba(255,255,255,1)
7959: 281x20+667+137 807.0,146.4 5328 srgba(255,255,255,1)
9341: 281x20+667+160 807.0,169.5 5328 srgba(255,255,255,1)
6540: 281x20+667+114 807.0,123.4 5295 srgba(255,255,255,1)
2375: 281x19+667+46 807.0,55.0 5047 srgba(255,255,255,1)
...
convert image.png -fuzz 5% -trim +repage \
-bordercolor black -border 1 \
-define connected-components:remove=0 \
-define connected-components:mean-color=true \
-connected-components 4 \
-background white -flatten \
-negate \
-define morphology:compose=darken \
-morphology Thinning 'Rectangle:1x80+0+0<' \
-negate \
result.png

Unable to copy alpha channel using ImageMagick

I have two tif images - input.tif and test.tif - and what I want to achieve is apply alpha channel of the first image to the second one. This is what I do now, using ImageMagick:
C:\Images> magick input.tif -alpha extract alpha.pgm
C:\Images> magick test.tif alpha.pgm -compose copyalpha -composite output.tif
When, however, I try to open output.tif, I get a message that the image is corrupt.
try adding -alpha off in your second command
C:\Images> magick input.tif -alpha extract alpha.pgm
C:\Images> magick test.tif alpha.pgm -alpha off -compose copy_opacity -composite output.tif
Or you can do it in one command as:
C:\Images> magick test.tif ( input.tif -alpha extract ) -alpha off -compose copy_opacity -composite output.tif

Imagemagick (convert: pixels are not authentic)

I have a command-line that outputs an image as intended but gives me an error on completion of convert: pixels are not authentic. Why could this be happening?
I am using ImageMagick 6.9.2-8 Q16 x86_64 2015-12-06 in Term2 on OSX El Capitan.
The command / output / error :
convert -verbose artwork.jpg -resize 1800x \
\( +clone -gravity center -background white -extent 2000x2000 \) \
\( -clone 1 displaceY.png -compose displace -define compose:args=0x5% -composite \) \
\( -clone 2 -gravity west displaceX.png -compose displace -define compose:args=5x0% -composite \) \
-delete 0--2 \( +clone alpha.png -compose copy_opacity -composite \) -delete 0 out.png
artwork.jpg JPEG 2952x2124 2952x2124+0+0 8-bit sRGB 911KB 0.000u 0:00.000
displaceY.png PNG 2000x2000 2000x2000+0+0 8-bit sRGB 109KB 0.000u 0:00.000
displaceX.png PNG 2400x2400 2400x2400+0+0 8-bit sRGB 104KB 0.000u 0:00.000
alpha.png PNG 2000x2000 2000x2000+0+0 8-bit sRGB 63.9KB 0.000u 0:00.000
artwork.jpg=>out.png JPEG 2952x2124=>2000x2000 2000x2000+0+0 8-bit sRGB 572KB 0.000u 0:00.000
convert: pixels are not authentic `artwork.jpg' # error/cache.c/QueueAuthenticPixelCacheNexus/4017.
It's hard to debug without the files and without knowing what you are trying to achieve, but I'll say what I see and maybe that will help. Here is what I think you have in the various layers:
0 - artwork 1800px wide
1 - artwork extended to 2000x2000
2 - clone of (1)
3 - clone of (2)
and then we come to the last line... and you delete 0--2 which is suspicious, did you mean 0-2, because 0--2 is actually 0,1.
So what did you mean to have in your image list after this -delete 0--2, I mean, how many images? I guess you meant to have 1 left.
Then you clone it, why do you do that? You could just copy the opacity right onto it and then you wouldn't need a -delete at the end?
No one can answer why this may have been happening but most could agree there is a better way of doing it, a few of these produce no error. It seems to be related to using clone request after a certain point in the chain.
Here are two commands that resolve this issue and provide the correct output image:
convert artwork.jpg +repage -thumbnail 1800x -gravity center -background white -extent 2000x2000 \
-gravity northwest displaceY.png +repage -compose over -compose displace -define compose:args=0x5% -composite \
-gravity northwest displaceX.png +repage -compose over -compose displace -define compose:args=5x0% -composite \
-gravity center alpha.png -compose over -compose copy_opacity -composite final.png
or
convert artwork.jpg +repage -thumbnail 1800x -gravity center -background white -extent 2000x2000 \
-gravity northwest displaceX.png displaceY.png +repage -compose over -compose displace -define compose:args=0x5% -composite \
-gravity center alpha.png -compose over -compose copy_opacity -composite final.png
Thanks to Fred over in the ImageMagick forums.

Resources