With Python + PIL, I created a script that creates a dummy image (called a wireframe image) used for the layout of a web page at once.
Defeated flavor. Python is using 2.7.
image-wire-frame-box.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Create a wireframe image
'''
import Image
import ImageDraw
import ImageFont
import sys
def make_image(screen, prefix, extension, pen_color, bg_color):
"""
Create image file
"""
#The font path is different for each flat form, so take that into consideration (actually, defeat it)
if sys.platform == "darwin":
#For OSX
#Japanese fonts didn't work
#FONTPATH = '/Library/Fonts/Osaka.ttf'
FONTPATH = '/Library/Fonts/Verdana.ttf'
elif sys.platform == "linux2":
#For Linux
FONTPATH = '/usr/share/fonts/truetype/fonts-japanese-gothic.ttf'
else:
#Other than that, it is judged as Windows (defeat)
# FONTPATH = 'hgrme.ttc'
FONTPATH = 'C:\WINDOWS\Fonts\MSGOTHIC.ttc'
#Specify font
font = ImageFont.truetype(FONTPATH, 24, encoding='utf-8')
img = Image.new('RGB', screen, bg_color)
x, y = img.size
u = x - 1
v = y - 1
draw = ImageDraw.Draw(img)
draw.line((0, 0, u, 0), pen_color)
draw.line((0, 0, u, v), pen_color)
draw.line((0, 0, 0, v), pen_color)
draw.line((u, 0, 0, v), pen_color)
draw.line((u, 0, u, v), pen_color)
draw.line((0, v, u, v), pen_color)
#Put text in the image (defeat)
if x > 63 and y > 24:
draw.text((2, (y - 24) / 2), str(x) + "x" + str(y),
font=font, fill=pen_color)
savefile = prefix + str(x) + "x" + str(y) + extension
img.save(savefile)
if __name__ == '__main__':
#Image size
screens = (
(16, 16), # favicon
(32, 32), # favicon
(24, 24), # windows icon
(48, 48), # windows icon / avatar
(96, 96), # windows icon / avatar
(64, 64), # mac icon / avatar
(128, 128), # mac icon / avatar
(100, 100), # icon / avatar
(150, 150), # icon / avatar
(256, 256), # icon / avatar ----
(320, 240), # QVGA
(240, 320), # QVGA
(640, 480), # VGA
(480, 640), #VGA (vertical)
(800, 600), # SVGA
(600, 800), #SVGA (vertical)
(1024, 768), # XGA
(768, 1024), #XGA (vertical)
(1280, 960), # Quad-VGA
(960, 1280), # Quad-VGA (vertical)
(1600, 1200), # UXGA
(1200, 1600), #UXGA (vertical)
(1280, 720), # HDTV 720p
(720, 1280), #HDTV 720p (vertical)
(1920, 1080), # HDTV 1080p
(1080, 1920), #HDTV 1080p (vertical)----
(88, 31), #IMU Micro Bar Micro Bar
(120, 60), #IMU Button 2 Button 2
(160, 600), #IMU Wide Skyscraper Wide Skyscraper
(300, 600), #IMU Half Page Ad Half Page
(180, 150), #IMU Rectangle Rectangle (Small)
(300, 250), #IMU Medium Rectangle Rectangle (Middle)
(728, 90), #IMU Leaderboard Big Banner
(120, 90), #IMU (Delete) Button 1 Button 1
(120, 240), #IMU (Deleted) Vertical Banner Vertical banner
(120, 600), #IMU (Deleted) Skyscraper Skyscraper
(125, 125), #IMU (Deleted) Square Button Square button, button
(234, 60), #IMU (Deleted) Half Banner Half Banner
(240, 400), #IMU (Deleted) Vertical Rectangle Vertical Rectangle
(250, 250), #IMU (Deleted) Square Pop-Up Square
(300, 100), #IMU (deleted) 3:1 Rectangle 3:1 rectangle
(336, 280), #IMU (Deleted) Large Rectangle Large Rectangle, Rectangle (Large)
(468, 60), #IMU (Deleted) Full Banner Banner, Full Banner
(720, 300), #IMU (Deleted) Pop-Under pop under
(200, 200), #Google Square (Small)
(970, 90), #Google Large Big Banner, Big Banner (Large)
(320, 50), #Google Mobile Big Banner
(320, 100), #Google Mobile Banner (Large)
(240, 400), #Google "Rectangle (vertical)" Russia
(980, 120), #Google "Panorama" Sweden and Finland
(250, 360), #Google "Triple Wide Screen" Sweden
(930, 180), #Google "Top Banner" Denmark
(580, 400), #Google "Netboard" Norway
(750, 100), #Google "Billboard" Poland
(750, 200), #Google "Double Billboard" Poland
(750, 300), #Google "Triple Billboard" Poland
(170, 40), #banner Details unknown
(180, 70), #banner Details unknown
(200, 40), #banner Even the banner size that is often found in Japanese CG
(400, 40) #banner Even the banner size that is common in Japan
)
#Specify the prefix
prefix = "wf-"
#Specify the file extension
#extension = ".png "
extension = ".jpg "
#Specify the drawing color (RGB)
pen_color = (0x00, 0x00, 0xdd)
#Specify the background color (RGB) of the image
bg_color = (0xdd, 0xdd, 0xdd)
for screen in screens:
print "size: %d,%d" % (screen[0], screen[1])
make_image(screen, prefix, extension, pen_color, bg_color)
#EOF
↓ An image like this is created softly.
Recommended Posts