Giter VIP home page Giter VIP logo

ai2html-workshop's Introduction

Maps and graphics with ai2html

[Leer en español]

ai2html is an open source script for Adobe Illustrator created by Archie Tse and The New York Times graphics team, which makes it easy to convert our Illustrator projects to HTML documents.

Installation

Download ai2html.js from the official repo and move it to your Adobe installation folder.

  • Windows: C:\Program Files\Adobe\Adobe Illustrator CC 2018\Presets\en_US\Scripts
  • macOS: Applications/Adobe Illustrator CC 2018/Presets/en_US/Scripts

Getting started

This script will let us export our graphics to a web format from Illustrator.

ai2html creates a HTML file where the text is transformed to HTML nodes (div with its corresponding css). The rest of the elements (lines, circles, maps, etc) will be converted to an image.

To run the script you need to go to File > Scripts . If you couldn't move the file to the Illustrator folder you can select Another script F12 on the same menu and select the file.

Once the file is exported a new box with options will appear on the left side of your artboard. The script has a series of options, some of them enabled and others hidden. You can choose now between the number of colours of the png, the quality of the jpg, output folder, retina resolution, etc.

It is important to change the colour mode to RGB and not use CMYK.

Don't forget to add your own font stack in the ai2html file.

Responsive graphics

One of the most important features of ai2html is the ability to export our graphics to different sizes. To get started:

  1. Create as many artboards as sizes you need (the script will use those dimensions). We have found that making a graphic between these sizes works well:
  • Desktop: 900-1100px
  • Tablet: 600-700px.
  • Phone: 290-320px.
  1. Download this script. This is the JavaScript that will switch between the different graphics according to the browser size.

  2. Once the design is exported, you need to edit the HTML and add that script. You'll see that ai2html creates only one HTML file and as many images as artboards exist on the Illustrator file.

Sample files

There are sample files that you can use as a starter in the files folder of this repo.

Try to create a design and play with it. You can also use SVGs from Wikipedia (I,II,III).

If there are strange characters on the browser you may need to declare UTF-8 encoding in your HTML. Add this at the beginning of the document:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Cons

  1. Despite being an open source script it only works on Adobe Illustrator, which is privative software.

  2. You'll need to make a different graphic for each size.

  3. Sometimes you will need to make small adjustments to the final output. The position of the text nodes can vary between browsers and configurations.

Resources

  1. QGIS free software to create vector maps.
  2. SVG Crowbar, a bookmarklet to extract SVGs from websites.

Examples


Mapas y gráficos con ai2html

ai2html es un plugin opensource para Adobe Illustrator desarrollado por Archie Tse y el equipo de gráficos del New York Times, que permite convertir nuestros proyectos Illustrator en documentos HTML.

Instalación

Descarga el archivo ai2html.js del repositorio oficial e inclúyelo en nuestra carpeta de adobe.
-Windows: C:\Program Files\Adobe\Adobe Illustrator CC 2018\Presets\es_ES\Secuencias de comandos
-macOS: Applications/Adobe Illustrator CC 2018/Presets/en_US/Scripts/ai2html.jsx

Utilización

Este script permite exportar nuestros proyectos a un formato web desde Illustrator.

ai2html crea un archivo HTML donde el texto es transformado en nodos HTML (div con sus correspondientes estilos css). El resto de elementos (líneas, círculos, basemaps, etc.) serán convertidos en una imagen.

Para correr el script tienes que ir a Archivo > Secuencias de comandos.

Si no has podido incluirlo en la carpeta de Illustrator puedes seleccionar el script a través de la opcion otra secuencia de comandos (F12) del mismo menu.

Una vez exportado, aparecerá un cuadro de opciones a la izquierda de nuestra mesa de trabajo. El plugin incluye una serie de opciones, unas activadas y otras ocultas. Puedes escoger el número de colores del archivo png, calidad del jpg, directorio al que exportará los archivos, exportar al doble de resolucion (retina), etc.

Es importante tener el modo de color de documento en RGB y no en CMYK.

No olvides añadir tu propio conjunto de fuentes en el script ai2html.

Gráficos responsive

Una de las grandes virtudes de ai2html es la posibilidad de exportar nuestros graficos a diferentes tamaños. Pasos:

  1. Crea tantas mesas de trabajo como diseños quieras obtener (el script usará estas dimensiones). Los siguientes tamaños funcionan bien:
  • Escritorio: 900-1100px
  • Tableta: 600-700px.
  • Teléfono: 290-320px.
  1. Descarga este script . Este archivo JavaScript se encargará de cambiar de un diseño a otro en función del tamaño del navegador.

  2. Una vez hayamos exportado nuestro diseño deberemos editar el html e incluir este script. También puedes añadir la opción include_resizer_script: yes en el cuadro de opciones que genera ai2html dentro de tu proyecto. ai2html creará un único archivo HTML y tantas imagenes como mesas de trabajo tenga tu proyecto.

Archivos de muestra

En la carpeta files de este repositorio puedes encontrar diferentes archivos para empezar a practicar así como un proyecto en Illustrator que incluye tres diseños.

Prueba a crear cualquier diseño, puede ser un mapa realizado con QGIS o un svg que hayas descargado por ejemplo de wikipedia (I,II,III).

Si tus textos tienen caracteres que requieren una codificación UTF-8 añade este tag al comienzo de tu html:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Desventajas

  1. A pesar de ser un plugin open-source sólo funciona en Adobe Illustrator (software privativo).

  2. Necesitas desarrollar manualmente un diseño para cada uno de los dispositivos en que será visualizado.

  3. Pequeños fallos: codificación, variación en el posicionamiento de los textos, errores en las posiciones de los textos por la confusion entre decimales y puntos en los estilos css inline, etc.

Recursos

  1. QGIS programa libre para crear mapas vectoriales.
  2. svg Crowbar permite descargar svg's de cualquier página.

Ejemplos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.