done
@ -0,0 +1,14 @@
|
|||||||
|
November 2021, ZineCamp, Worm
|
||||||
|
|
||||||
|
Welcome to
|
||||||
|
## # Not-completely-fully automated {{luxury}} layouting # ##
|
||||||
|
|
||||||
|
Thanks to be here!
|
||||||
|
|
||||||
|
|
||||||
|
Useful links:
|
||||||
|
|
||||||
|
https://pigment.shapefactory.co/
|
||||||
|
|
||||||
|
https://www.pagedjs.org/
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title></title>
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1><a href="https://canadiandimension.com/images/made/images/reviews/_resized/Fully_Automated_Luxury_Communism_cover_300_440_80.jpg" target="_blank">## # Not-completely-fully automated {{luxury}} layouting # ##<a></h1>
|
||||||
|
<h2>Welcome %%%%%%%%%%</h2>
|
||||||
|
|
||||||
|
<a href="https://www.pagedjs.org/" target="_blank">Introducing paged.js</a><br>
|
||||||
|
<hr>
|
||||||
|
<a href="scrape.php" target="_blank">The Sacred Pizza and the Abominable Platforms</a><br>
|
||||||
|
<hr>
|
||||||
|
<a href="collective/" target="_blank">A collective chaos</a><br>
|
||||||
|
<a href="non-linear-layouting/grammar/" target="_blank">Play with grammar</a><br>
|
||||||
|
<a href="non-linear-layouting/telegramChat/" target="_blank">Booklet from a telegram group chat</a><br>
|
||||||
|
<a href="https://hub.xpub.nl/sandbot/~poni/__lab__/lab/tree/OCR/OCR.ipynb" target="_blank">OCR! Optical Character Recognition => image to text</a><br>
|
||||||
|
<hr>
|
||||||
|
<a href="non-linear-layouting/image_scraping/" target="_blank">Scrape images from duckduckgo [beta]</a>
|
||||||
|
<a href="https://hub.xpub.nl/sandbot/~poni/scrapeMeansProd/" target="_blank">Other examples</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openPdf(){
|
||||||
|
$.ajax({url:"scrape.php", success:function(result){}})}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,28 @@
|
|||||||
|
# November 2021, copyleft || Funix || Zine Camp, Worm, Rotterdam
|
||||||
|
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
import pytesseract as pt
|
||||||
|
import os
|
||||||
|
from PIL import Image, ImageEnhance
|
||||||
|
|
||||||
|
def read_img(img):
|
||||||
|
img = cv2.imread(img)
|
||||||
|
return pt.image_to_string(img)
|
||||||
|
|
||||||
|
name = "silenzionubi"
|
||||||
|
|
||||||
|
|
||||||
|
im = Image.open(f'OCR/scans/{name}.jpg')
|
||||||
|
enhancer = ImageEnhance.Contrast(im)
|
||||||
|
factor = 1.5
|
||||||
|
im_output = enhancer.enhance(factor)
|
||||||
|
!mkdir OCR/scansN/
|
||||||
|
im_output.save(f'OCR/scansN/{name}.png')
|
||||||
|
|
||||||
|
txt = read_img(f'OCR/scansN/{name}.png')
|
||||||
|
|
||||||
|
!mkdir OCR/txt
|
||||||
|
got = open(f'OCR/txt/{name}.txt','w')
|
||||||
|
got.write(txt)
|
||||||
|
got.close()
|
@ -0,0 +1,71 @@
|
|||||||
|
@media print {
|
||||||
|
/* Define the size of the pages and layout settings */
|
||||||
|
@page {
|
||||||
|
size: 148mm 210mm;
|
||||||
|
margin: 15mm;
|
||||||
|
}
|
||||||
|
/* Custom font */
|
||||||
|
@font-face {
|
||||||
|
font-family: "";
|
||||||
|
src: url("");
|
||||||
|
}
|
||||||
|
/* Custom variables */
|
||||||
|
:root {
|
||||||
|
--first: #19b7b9;
|
||||||
|
--second: #0b1136;
|
||||||
|
--third: #2e4473;
|
||||||
|
}
|
||||||
|
/* Rules for everything */
|
||||||
|
body {
|
||||||
|
font-family: "";
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 35px;
|
||||||
|
}
|
||||||
|
/* Rules for the rest */
|
||||||
|
.contents {
|
||||||
|
break-before: left
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
/* Rules for dots */
|
||||||
|
.dot {
|
||||||
|
color: var(--third);
|
||||||
|
}
|
||||||
|
/* Rules for Part Of Speech (POS), defined in classes in <span> */
|
||||||
|
/* This case, conjunctions + verbs ) */
|
||||||
|
span.NN {
|
||||||
|
background-color: salmon;
|
||||||
|
color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
span.CC {
|
||||||
|
color: var(--first);
|
||||||
|
}
|
||||||
|
span.VB {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
span.VBD {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
span.VBG {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
span.VBN {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
span.VBP {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
span.VBZ {
|
||||||
|
font-size: 3vw;
|
||||||
|
color: var(--second);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
# November 2021, copyleft || Funix || Zine Camp, Worm, Rotterdam
|
||||||
|
|
||||||
|
# Scrape and download images in local from DuckDuckGo
|
||||||
|
|
||||||
|
# with DuckDuckGoImages!
|
||||||
|
|
||||||
|
import DuckDuckGoImages as ddg # import the library for scrape
|
||||||
|
import os # to manipulate the file system
|
||||||
|
import shutil # same but powerfull >:D
|
||||||
|
import time # to create delays :: for having a few seconds to check the console
|
||||||
|
import random # to get random numbers
|
||||||
|
from urllib.request import urlopen # to request urls usage
|
||||||
|
|
||||||
|
|
||||||
|
# start the layouting :: html + css + paged.js >>
|
||||||
|
|
||||||
|
# declare the first part of the text of the html, we will fill it
|
||||||
|
# in the process with loops
|
||||||
|
html = '''
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="../../script/interface.css">
|
||||||
|
<script src="../../script/paged.polyfill.js"></script>
|
||||||
|
<link rel="stylesheet" href="./style.css">
|
||||||
|
<title>📡 💻📘</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="firstP">
|
||||||
|
<h1 style="position: absolute; top: 0; left:0; color: black;">Title!</h1>
|
||||||
|
|
||||||
|
<p style="position: absolute; bottom: 0; right:0;">Authors!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="contents"><p>
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
# Prepare the local folder :: where the images will be saved >>
|
||||||
|
|
||||||
|
if os.path.isdir('./images/'): # check if the folder "images" exists
|
||||||
|
shutil.rmtree('./images/') # if yes, delete it
|
||||||
|
|
||||||
|
os.mkdir('./images/') # and then create a fresh new one
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
url = 'https://pad.xpub.nl/p/ddg/export/txt'
|
||||||
|
response = urlopen(url)
|
||||||
|
qq = response.read().split()
|
||||||
|
|
||||||
|
print(qq) # print the array!
|
||||||
|
|
||||||
|
|
||||||
|
time.sleep(2) # check qq in the console!
|
||||||
|
|
||||||
|
|
||||||
|
# Elaborate each word :: process every element of the array qq
|
||||||
|
for q in qq:
|
||||||
|
|
||||||
|
q = q.decode()
|
||||||
|
|
||||||
|
print(q) # print the q!
|
||||||
|
|
||||||
|
os.mkdir(f'./images/{q}/') # create the folder
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Scrape images with ddg.download()! :: we imported DuckDuckGoImages *as* ddg,
|
||||||
|
# it's just compacted the name
|
||||||
|
|
||||||
|
# q is, indeed, the query for DuckDuckGo
|
||||||
|
# folder=(../path/to/download)
|
||||||
|
# max_urls=(how many results attempt to scrape
|
||||||
|
# thumbnails=(True/False, to download thumbnails or bigger images)
|
||||||
|
|
||||||
|
ddg.download(q, folder= f"./images/{q}/", max_urls=5, thumbnails=True)
|
||||||
|
|
||||||
|
|
||||||
|
picc = os.listdir(f"./images/{q}/") # get the contents of the folder
|
||||||
|
# each downloaded image will have a randomic UUIDv4 name so next step is
|
||||||
|
# to change its name with the name of the current q
|
||||||
|
|
||||||
|
if len(picc) == 0: # if the the list is empty..
|
||||||
|
html += f'{q}' # ..add now the <html> for just the text, since there are no images downloaded..
|
||||||
|
html += "\n"
|
||||||
|
os.rmdir(f'./images/{q}/') # ..and delete the folder created, since is useless..
|
||||||
|
continue # ..from now on this q can't do anything more, let's go to the next iteration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Layout q and its pic!
|
||||||
|
pic = picc[0] # let's take a random picture from the array
|
||||||
|
|
||||||
|
os.rename(f'./images/{q}/{pic}', f'./images/{q}/{q}.jpg') # This is to rename the pic with qBinded + the .jpg extension
|
||||||
|
os.replace(f'./images/{q}/{q}.jpg', f'./images/{q}.jpg') # This is to move the pic to the main folder
|
||||||
|
shutil.rmtree(f'./images/{q}/') # and it's time to delete the folder of this q
|
||||||
|
|
||||||
|
html += f""" {q}""" # Now let's fill the html with text and the pic
|
||||||
|
html += "\n"
|
||||||
|
html += f""" <span><img src="./images/{q}.jpg"></span>"""
|
||||||
|
html += "\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Close the html text
|
||||||
|
html += ''' </p><div>
|
||||||
|
</body>
|
||||||
|
</html>'''
|
||||||
|
|
||||||
|
with open('index.html','w') as index: # Save the <html> file!
|
||||||
|
index.write(html)
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 70 KiB |
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="../../script/interface.css">
|
||||||
|
<script src="../../script/paged.polyfill.js"></script>
|
||||||
|
<link rel="stylesheet" href="./style.css">
|
||||||
|
<title>📡 💻📘</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="firstP">
|
||||||
|
<h1 style="position: absolute; top: 0; left:0; color: black;">Title!</h1>
|
||||||
|
|
||||||
|
<p style="position: absolute; bottom: 0; right:0;">Authors!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="contents"><p>
|
||||||
|
It
|
||||||
|
<span><img src="./images/It.jpg"></span>
|
||||||
|
lasts
|
||||||
|
<span><img src="./images/lasts.jpg"></span>
|
||||||
|
a
|
||||||
|
<span><img src="./images/a.jpg"></span>
|
||||||
|
fraction
|
||||||
|
<span><img src="./images/fraction.jpg"></span>
|
||||||
|
of
|
||||||
|
<span><img src="./images/of.jpg"></span>
|
||||||
|
life
|
||||||
|
<span><img src="./images/life.jpg"></span>
|
||||||
|
like
|
||||||
|
<span><img src="./images/like.jpg"></span>
|
||||||
|
the
|
||||||
|
<span><img src="./images/the.jpg"></span>
|
||||||
|
truth
|
||||||
|
<span><img src="./images/truth.jpg"></span>
|
||||||
|
of
|
||||||
|
<span><img src="./images/of.jpg"></span>
|
||||||
|
making
|
||||||
|
<span><img src="./images/making.jpg"></span>
|
||||||
|
sense
|
||||||
|
<span><img src="./images/sense.jpg"></span>
|
||||||
|
that
|
||||||
|
<span><img src="./images/that.jpg"></span>
|
||||||
|
you
|
||||||
|
<span><img src="./images/you.jpg"></span>
|
||||||
|
can
|
||||||
|
<span><img src="./images/can.jpg"></span>
|
||||||
|
find
|
||||||
|
<span><img src="./images/find.jpg"></span>
|
||||||
|
around
|
||||||
|
<span><img src="./images/around.jpg"></span>
|
||||||
|
It
|
||||||
|
<span><img src="./images/It.jpg"></span>
|
||||||
|
won't
|
||||||
|
<span><img src="./images/won't.jpg"></span>
|
||||||
|
end
|
||||||
|
<span><img src="./images/end.jpg"></span>
|
||||||
|
not
|
||||||
|
<span><img src="./images/not.jpg"></span>
|
||||||
|
so
|
||||||
|
<span><img src="./images/so.jpg"></span>
|
||||||
|
soon
|
||||||
|
</p><div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,35 @@
|
|||||||
|
@media print {
|
||||||
|
/* Define the size of the pages and layout settings */
|
||||||
|
@page {
|
||||||
|
size: 148mm 210mm;
|
||||||
|
margin: 15mm;
|
||||||
|
}
|
||||||
|
/* Custom fonts */
|
||||||
|
@font-face {
|
||||||
|
font-family: "";
|
||||||
|
src: url("");
|
||||||
|
}
|
||||||
|
/* Custom variables */
|
||||||
|
:root {}
|
||||||
|
/* Rules for everything */
|
||||||
|
body {
|
||||||
|
font-family: "courier";
|
||||||
|
font-size: 40px;
|
||||||
|
line-height: 36px;
|
||||||
|
}
|
||||||
|
/* Rules for the rest */
|
||||||
|
.contents {
|
||||||
|
break-before: right;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
margin: 0 1ch;
|
||||||
|
height: 45px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
break-after: none;
|
||||||
|
}
|
||||||
|
}
|
@ -1,85 +0,0 @@
|
|||||||
@media print {
|
|
||||||
/* Define the size of the pages and layout settings */
|
|
||||||
|
|
||||||
@page {
|
|
||||||
size: 148mm 210mm;
|
|
||||||
marks: crop cross;
|
|
||||||
margin: 15mm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Custom font */
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "neuzeit";
|
|
||||||
src: url("./fonts/NeuzeitOffice-Regular.ttf");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "fivo";
|
|
||||||
src: url("./fonts/fivo-sans.medium.otf");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Custom variables */
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--first: #19b7b9;
|
|
||||||
--second: #0b1136;
|
|
||||||
--third: #2e4473;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules for everything */
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: "neuzeit";
|
|
||||||
font-size: 20px;
|
|
||||||
line-height: 35px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules for the rest */
|
|
||||||
|
|
||||||
.contents{
|
|
||||||
break-before: left
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules for dots */
|
|
||||||
|
|
||||||
.dot {
|
|
||||||
color: var(--third);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rules for Part Of Speech (POS), defined in classes in <span> */
|
|
||||||
/* This case, conjunctions + verbs ) */
|
|
||||||
|
|
||||||
span.CC {
|
|
||||||
font-size: 3vw;
|
|
||||||
color: var(--first);
|
|
||||||
}
|
|
||||||
|
|
||||||
span.VB {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
span.VBD {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
span.VBG {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
span.VBN {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
span.VBP {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
span.VBZ {
|
|
||||||
color: var(--second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 314 KiB |
After Width: | Height: | Size: 314 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 325 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 318 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 207 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 342 KiB |
After Width: | Height: | Size: 325 KiB |
After Width: | Height: | Size: 410 KiB |
After Width: | Height: | Size: 245 KiB |
After Width: | Height: | Size: 225 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 233 KiB |
After Width: | Height: | Size: 489 KiB |
After Width: | Height: | Size: 460 KiB |
After Width: | Height: | Size: 343 KiB |
After Width: | Height: | Size: 263 KiB |
After Width: | Height: | Size: 241 KiB |
After Width: | Height: | Size: 289 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 262 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 310 KiB |
After Width: | Height: | Size: 213 KiB |
After Width: | Height: | Size: 197 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 245 KiB |
After Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 207 KiB |
After Width: | Height: | Size: 319 KiB |
After Width: | Height: | Size: 315 KiB |
After Width: | Height: | Size: 370 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 360 KiB |
After Width: | Height: | Size: 392 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 278 KiB |
After Width: | Height: | Size: 203 KiB |