-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen.py
21 lines (19 loc) · 8.05 KB
/
gen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from PIL import Image
text = 'Soon after his succession, probably in 1058, Guiscard separated from his wife Alberada because they were related within the prohibited degrees. Shortly after, he married Sichelgaita, the sister of Gisulf II of Salerno, Guaimar\'s successor. In return for giving him his sister\'s hand, Gisulf demanded that Guiscard destroy two castles of his brother William, count of the Principate, which had encroached on Gisulf\'s territory.\nThe reformist Papacy, at odds with the Holy Roman Emperor (due to the Investiture Controversy) and the Roman nobility itself, resolved to recognize the Normans and secure them as allies. Therefore, in the Treaty of Melfi, on 23 August 1059, Pope Nicholas II invested Guiscard as duke of Apulia, Calabria, and Sicily.[20] Guiscard, now "by the Grace of God and St Peter duke of Apulia and Calabria and, if either aid me, future lord of Sicily", agreed to hold his titles and lands by annual rent of the Holy See and to maintain its cause. In the next twenty years he undertook a series of conquests, winning his Sicilian dukedom.\nSubjugation of Calabria\nAt the time of the opening of the Melfitan council in June, Guiscard had been leading an army in Calabria, the first strong attempt to subjugate that Byzantine province since the campaigns of Iron-Arm with Guaimar. After attending the synod for his investiture, Guiscard returned to Calabria, where his army was besieging Cariati. After his arrival, Cariati submitted and, before winter was out, Rossano and Gerace followed. Only Reggio was left in Byzantine hands when Guiscard returned to Apulia. In Apulia, he worked to remove the Byzantine garrisons from Taranto and Brindisi, before, largely in preparation for his planned Sicilian expedition, he returned again to Calabria, where Roger was waiting with siege engines.\nThe fall of Reggio, after a long and arduous siege, and the subsequent capitulation of Scilla, an island citadel to which the Reggian garrison had fled, opened up the way to Sicily. Roger first led a tiny force to attack Messina but was repulsed easily by the Saracen garrison. The large invading force that could have been expected did not materialise, for Guiscard was recalled by a new Byzantine army, sent by Constantine X Doukas, ravaging Apulia. In January 1061, Melfi itself was under siege, and Roger too was recalled. But the full weight of Guiscard\'s forces forced the Byzantines to retreat and by May Apulia was calm.\nSicilian campaigns\nMulticoloured map of Italian peninsula, showing smaller states\nNorman progress in Sicily during Robert\'s expeditions to the Balkans: Capua, Apulia and Calabria, and the County of Sicily are Norman. The Emirate of Sicily, the Duchy of Naples and lands in the Abruzzo (in the southern Duchy of Spoleto) are not yet conquered.\nMain article: Norman conquest of Sicily\nGuiscard invaded Sicily with his brother Roger, capturing Messina in 1061 with comparable ease: they landed unsighted during the night and surprised the Saracen army.[21] This success gave them control over the Strait of Messina.[21] Guiscard immediately fortified Messina and allied himself with Ibn al-Timnah, one of the rival emirs of Sicily, against Ibn al-Hawas, another emir. The armies of Guiscard, his brother, and his Muslim friend marched into central Sicily by way of Rometta, which had remained loyal to al-Timnah. They passed through Frazzanò and the pianura di Maniace, where George Maniakes and the first Hautevilles had distinguished themselves 21 years prior. Guiscard assaulted the town of Centuripe, but resistance was strong, and he moved on. Paternò fell, and Guiscard brought his army to Enna (then Castrogiovanni), a formidable fortress. The Saracens sallied forth and were defeated, but Enna itself did not fall. Guiscard turned back, leaving a fortress at San Marco d\'Alunzio, named after his first stronghold in Calabria. He returned to Apulia with Sichelgaita for Christmas.\nHe returned in 1064, but bypassed Enna making straight for Palermo. His campsite was infested with tarantulas, however, and had to be abandoned. The campaign was unsuccessful, though a later campaign, in 1072, saw Palermo fall, and for the rest of Sicily it was only then a matter of time. As a result of his Sicilian campaign, Guiscard was referred to as "Black Shirt Robert" because throughout the campaign he wore elegant clothing with imported dyes that ran together resulting in black clothing.[22]\nAgainst the Byzantines\nBari was reduced in April 1071, and Byzantine forces were finally ousted from southern Italy. The territory around Salerno was already held by Guiscard, and in December 1076 he took the city, expelling its Lombard prince Gisulf, whose sister Sichelgaita he had married. The Norman attacks on Benevento, a papal fief, alarmed and angered Pope Gregory VII. Pressured by the emperor, Henry IV, Gregory VII turned again to the Normans, and at Ceprano in June 1080, he reinvested Guiscard, securing him also in the southern Abruzzi, while reserving Salerno.[clarification needed]\nIn his last enterprise, Guiscard mounted an attack on the Byzantine Empire, taking up the cause of Raiktor, a monk pretending to be Michael VII,[23] who had been deposed in 1078 and to whose son Guiscard\'s daughter had been betrothed. He sailed with 16,000 men, including 1,300 Norman knights, against the empire in May 1081. He defeated Emperor Alexius I Comnenus at the Battle of Dyrrhachium in October 1081, and by February 1082 he had occupied Corfu and Durazzo. He was recalled to the aid of Gregory VII, however, who was besieged in Castel Sant\'Angelo by Henry IV, in June 1083. Also in 1083, Guiscard destroyed the town of Cannae, leaving only the cathedral and bishop\'s residence.[24] Guiscard was ally to kingdom of Duklja and Constantine Bodin. In 1081 he married his vassal\'s daughter Jaquinta of Bari to Bodin.\nHauteville family mausoleum, where Robert Guiscard was buried. Trinity Abbey in Venosa, Italy.\nIn May 1084, Guiscard marched north with 36,000 men, entered Rome, and forced Henry to retreat. A rebellion, or seditious tumult (émeute), of the citizens led to a three-day sack of the city, after which Guiscard escorted the pope to Rome. Guiscard\'s son Bohemund, for a time master of Thessaly, had now lost the Byzantine conquests. Guiscard returned with 150 ships to restore them, and he occupied Corfu and Kefalonia with the help of Ragusa and the Dalmatian cities (which were under the rule of Demetrius Zvonimir of Croatia).[25] On 17 July 1085, Guiscard died of fever in Kefalonia, at Atheras, north of Lixouri, along with 500 Norman knights.[26][27] He was buried in the Hauteville family mausoleum of the Abbey of the Santissima Trinità at Venosa. The town of Fiscardo on Kefalonia is named after him.\nGuiscard was succeeded by Roger Borsa, his son by Sichelgaita, as Bohemund, his son by an earlier wife Alberada de Macon (aka Alberada of Buonalbergo), was set aside. Guiscard left two younger sons: Guy of Hauteville and Robert Scalio, neither of whom made any trouble for their elder brothers. At his death Guiscard was duke of Apulia and Calabria, prince of Salerno, and suzerain of Sicily. His successes had been due not only to his great qualities but to the "entente" with the Papal See. He created and enforced a strong ducal power, which was nevertheless met by many baronial revolts, including one in 1078, when he demanded from the Apulian vassals an "aid" on the betrothal of his daughter. In conquering such wide territories he had little time to organize them internally. In the history of the Norman kingdom of Italy, Guiscard remains essentially the hero and founder, though his career ended in "something of a dead end,"[28] while his nephew Roger II was the statesman and organizer.'
flag = open('flag.txt').read()
to_write = bytes(flag+text, 'utf-8')
pos = 0
with Image.open("original.png") as im:
h, w = im.size
loaded = im.load()
for i in range(h):
for j in range(w):
if pos >= len(to_write)*8:
break
r, g, b = loaded[i,j]
r = (r&~1) | ((to_write[pos//8] >> pos%8)&1)
loaded[i,j] = (r, g, b)
pos += 1
if pos >= len(to_write)*8:
break
im.save("image.png")