-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translating python Pixel workshop to spanish, Will update it incremen… #500
base: master
Are you sure you want to change the base?
Translating python Pixel workshop to spanish, Will update it incremen… #500
Conversation
@@ -0,0 +1,48 @@ | |||
--- | |||
title: "Actividad 1: Crea un tablero de colores" | |||
prereq: "Conceptos básicos de Python, Manipulación de imágenes en Python: Abrir una imagen, Pixels de Python: Colores y Pixels" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Píxeles de Python: Colores y Píxeles
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/Nz3Uz4kBoUU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
|
||
## Ejemplo para un tablero de colores básico |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ejemplo para crear un tablero de colores básico
--- | ||
title: "Actividad 2: Modifica tu tablero de colores" | ||
date: 2020-07-11T00:00:00Z | ||
prereq: "Conceptos básicos de Python, Python Pixeles: Colores y Pixeles, Manipulación de imágenes Python: Abrir una imagen" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptos básicos de Python, Python Píxeles: Colores y Píxeles, Manipulación de imágenes Python: Abrir una imagen
|
||
## Más sobre los píxeles | ||
|
||
Ya hemos aprendido cómo crear una imagen de color puro usando píxeles y cambiar un píxel en la imagen. Ahora, aprenderemos a identificar píxeles en imágenes existentes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya hemos aprendido cómo crear una imagen de color solo usando píxeles y cambiar un píxel en la imagen.
Image.size[0] | ||
Image.size[1] | ||
``` | ||
`Image.size` proporciona un valor `(ancho, altura)` de una imagen. `Image.size[0]` da el ancho de la imagen y `Image.size[1]` da la altura de la imagen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proporciona un valor (ancho, altura)
de una imagen. Image.size[0]
escribe el ancho de la imagen y Image.size[1]
escribe la altura de la imagen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y en Image.size[1] escribe la altura de la imagen.
@@ -0,0 +1,22 @@ | |||
--- | |||
title: "Actividad 11: Desafío: Crea tu propia imagen" | |||
prereq: "Conceptos básicos de Python, Manipulación de imágenes con Python: Abre una imagen, Python Pixel: Colores y píxeles" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Conceptos básicos de Python, Manipulación de imágenes con Python: Abre una imagen, Python Pixel: Colores y Píxeles"
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/KWL3b4xY8dA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
|
||
En esta sección, utilizaremos lo que has aprendido hasta ahora para crear y modificar tu propia imagen. En esta sección, tienes la libertad de hacer cualquier combinación de tablas de colores básicas, elementos de dibujo, filtros, recortes, volteos, cambios de colores o texto. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En esta sección, utilizaremos lo que has aprendido hasta ahora para crear y modificar tu propia imagen. En esta sección, tienes la libertad de hacer cualquier combinación de tablas de colores básicas, elementos de dibujo, filtros, recortes, giros, cambios de colores o texto.
@@ -0,0 +1,47 @@ | |||
--- | |||
title: "Actividad 3: Desafío: Diseñar nuevos elementos" | |||
prereq: "Conceptos básicos de Python, Manipulación de imágenes en Python: Abrir una imagen, Python Pixeles: Colores y Pixeles" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Conceptos básicos de Python, Manipulación de imágenes en Python: Abrir una imagen, Python Píxeles: Colores y Píxeles"
--- | ||
title: "Actividad 4: Crear Filtro Básico" | ||
date: 2020-09-08T00:00:00Z | ||
prereq: "Fundamentos de Python, Python Pixels: Colores y Píxeles, Manipulación de Imágenes en Python: Abrir una imagen" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Fundamentos de Python, Python Píxeles: Colores y Píxeles, Manipulación de Imágenes en Python: Abrir una imagen"
### Ejemplo para filtro azul | ||
|
||
<img src="../../media/cat.png" width=50%> | ||
Queremos agregar un filtro azul al lindo gato de arriba. Veamos cómo lograrlo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Queremos agregarle un filtro azul al lindo gato de arriba. Veamos cómo lograrlo.
--- | ||
title: "Actividad 5: Filtros más avanzados" | ||
date: 2020-09-08T00:00:00Z | ||
prereq: "Conceptos básicos de Python, Python Pixels: Colores y píxeles, Manipulación de imágenes en Python: Abrir una imagen" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Conceptos básicos de Python, Python Píxeles: Colores y Píxeles, Manipulación de imágenes en Python: Abrir una imagen"
{{% notice tip %}} | ||
Recuerda, para establecer un píxel gris, los tres valores RGB deben ser iguales. Sin embargo, establecer cada píxel al mismo valor aleatorio (ej. 200) hará que toda la imagen sea gris, en lugar de solo añadir un filtro sobre la imagen existente del gato. | ||
|
||
¿Cómo podemos averiguar mejor cómo establecer un píxel para que sea la versión 'griseada' de sí mismo? Podemos tomar un promedio de cada valor de los colores RGB. Puedes usar // para hacer una división entera, lo que garantiza que el resultado de la operación de promediado sea un número entero. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Cómo podemos averiguar mejor cómo establecer un píxel para que sea la versión 'grisácea' de sí mismo? Podemos tomar un promedio de cada valor de los colores RGB. Puedes usar // para hacer una división entera, lo que garantiza que el resultado de la operación de promediado sea un número entero.
@@ -0,0 +1,78 @@ | |||
--- | |||
title: "Actividad 6: Recortar Imagen" | |||
prereq: "Conceptos Básicos de Python, Manipulación de Imágenes en Python: Abrir una Imagen, Python Pixel: Colores y Píxeles" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Conceptos Básicos de Python, Manipulación de Imágenes en Python: Abrir una Imagen, Python Píxel: Colores y Píxeles"
|
||
En esta sección, comenzaremos a aprender cómo recortar tu imagen. | ||
|
||
### Ejemplo - Recortar al gato a la mitad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ejemplo - Recortar la imagen del gato a la mitad
|
||
<img src="../../media/halfcat.png" width=25%> | ||
|
||
### Ejemplo - Recortar la pieza central |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ejemplo - Recortar el centro de la imagen
@@ -0,0 +1,96 @@ | |||
--- | |||
title: "Actividad 8: Voltea tu imagen" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Actividad 8: Gira tu imagen"
--- | ||
title: "Actividad 8: Voltea tu imagen" | ||
date: 2020-09-08T00:00:00Z | ||
prereq: "Conceptos básicos de Python, Python Pixels: Colores y Píxeles, Manipulación de imágenes con Python: Abrir una imagen" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Conceptos básicos de Python, Python Píxeles: Colores y Píxeles, Manipulación de imágenes con Python: Abrir una imagen"
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/Jx_b8111WW0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | ||
|
||
En esta sección, comenzaremos a aprender cómo voltear tu imagen usando píxeles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En esta sección, comenzaremos a aprender cómo girar tu imagen usando píxeles.
|
||
### Ejemplo - Voltea tu imagen boca abajo | ||
|
||
Vamos a voltear el gato boca abajo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vamos a girar el gato hacia abajo.
|
||
En esta sección, comenzaremos a aprender cómo voltear tu imagen usando píxeles. | ||
|
||
### Ejemplo - Voltea tu imagen boca abajo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ejemplo - Gira tu imagen hacia abajo
|
||
{{% notice note %}} | ||
|
||
Voltear la imagen boca abajo es lo mismo que crear una imagen simétrica con respecto a la `línea central horizontal`, que es la línea negra en la siguiente imagen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Girar la imagen hacia abajo es lo mismo que crear una imagen simétrica con respecto a la línea central horizontal
, que es la línea negra en la siguiente imagen.
|
||
Vamos a sumergirnos en la creación de imágenes. ¡No olvides que aprendimos a abrir y guardar imágenes en Python usando el módulo Pillow en las secciones anteriores! | ||
|
||
## Creando imágenes usando píxeles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creación de imágenes usando píxeles
|
||
Si estás usando una imagen diferente, asegúrate de poner el nombre del archivo entre las comillas. El código anterior abre la imagen JPG y guarda esa imagen en la variable image. Para comprobar que la variable image tiene la imagen, podemos guardarla como una nueva imagen. De esta manera, la imagen se mostrará en la ventana. | ||
|
||
¡Presiona ejecutar y ve aparecer tu imagen! Mi imagen se ve así: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¡Presiona ejecutar y aparecerá tu imagen! Mi imagen se ve así:
|
||
 | ||
|
||
Si ves lo anterior, significa que has importado un módulo con éxito. Si tienes problemas, por favor pide ayuda antes de continuar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si puedes ver lo anterior, significa que has importado un módulo con éxito. Si tienes problemas, por favor pide ayuda antes de continuar.
</br> | ||
{{% /showanswer %}} | ||
|
||
*Nota: No te preocupes si te sientes confundido aquí, explicaremos más sobre estas ideas en las actividades de código de python más adelante en el taller.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nota: No te preocupes si estas ideas parecen confusas en este momento. A lo largo del taller, las aclararemos con más detalle durante las actividades prácticas de código en Python.
newimg.save("Mycat.png") | ||
``` | ||
|
||
¡Wow! Este es nuestro nuevo gato después de voltear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¡Wow! Este es nuestro nuevo gato después de girarlo.
|
||
<img src="../../media/flipcat.png" width=50%> | ||
|
||
¿Cómo descubrimos cómo establecer `heightNew`? En el código anterior tenemos: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Cómo podemos determinar la forma correcta de establecer heightNew
? En el código anterior tenemos:
|
||
`heightNew = height - 1 - j` | ||
|
||
Este es el punto clave para voltear el gato boca abajo. Esto toma la altura de la imagen y resta 1 así como la ubicación actual de la altura del píxel (j). Restamos 1 para el índice; recuerda que las computadoras comienzan a contar desde '0' en lugar de '1'. Restamos la ubicación actual de la altura del píxel para obtener la ubicación de donde debería estar el nuevo píxel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este es el punto clave para girar al gato hacia abajo. Esto toma la altura de la imagen y resta 1 así como la ubicación actual de la altura del píxel (j). Restamos 1 para el índice; recuerda que las computadoras comienzan a contar desde '0' en lugar de '1'. Restamos la ubicación actual de la altura del píxel para obtener la ubicación de donde debería estar el nuevo píxel.
|
||
### Desafío - Voltea tu gato de izquierda a derecha | ||
|
||
Ahora es tu turno de voltear tu gato de izquierda a derecha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahora es tu turno de girar tu gato de izquierda a derecha.
|
||
Luego crea la salida simétrica con respecto a la línea central horizontal y compárala con la salida anterior. ¿Son iguales? | ||
|
||
### Desafío - Voltea tu gato de izquierda a derecha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Desafío - Gira tu gato de izquierda a derecha
|
||
{{% notice note %}} | ||
|
||
Voltear la imagen de izquierda a derecha es lo mismo que crear una imagen simétrica con respecto a la `línea central vertical`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Girar la imagen de izquierda a derecha es lo mismo que crear una imagen simétrica con respecto a la línea central vertical
.
width = img.size[0] | ||
height = img.size[1] | ||
|
||
# Configurar una nueva imagen con la misma anchura y altura |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configurar una nueva imagen con el mismo ancho y alto
Luego, gíralo 180 grados en sentido horario y compáralo con el resultado anterior. ¿Son iguales? | ||
{{% /notice %}} | ||
|
||
### Desafío - Rota tu gato 90 grados en sentido antihorario |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rota tu gato 90 grados en sentido contrario a las agujas del reloj.
|
||
### Desafío - Rota tu gato 90 grados en sentido antihorario | ||
|
||
¡Ahora es tu turno de rotar tu gato 90 grados en sentido antihorario! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¡Ahora es tu turno de rotar tu gato 90 grados en sentido contrario a las agujas del reloj!
|
||
El módulo Pillow tiene funciones que pueden ayudar a simplificar los pasos anteriores. Para hacerlo, veamos la función `rotate()` de `Pillow Image`. | ||
|
||
La rotación de imagen funciona usando ángulos. Por ejemplo, `rotate(45)` inclinará tu imagen de lado 45 grados. Usar `rotate(90)` girará tu imagen de lado. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La rotación de imagen funciona usando ángulos. Por ejemplo, rotate(45)
inclinará tu imagen de lado 45 grados. Usar rotate(90)
rotará tu imagen de lado.
image.save("myCat.jpg") | ||
``` | ||
|
||
Desafío: ¿puedes girar esta imagen completamente? ¿Puedes girar la imagen 3/4 sin usar un ángulo > 180? (Pista: ¡intenta usar números de ángulo negativos!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Desafío: ¿puedes rotar esta imagen completamente? ¿Puedes rotar la imagen 3/4 sin usar un ángulo > 180? (Pista: ¡intenta usar ángulos negativos!)
|
||
Desafío: ¿puedes girar esta imagen completamente? ¿Puedes girar la imagen 3/4 sin usar un ángulo > 180? (Pista: ¡intenta usar números de ángulo negativos!) | ||
|
||
Girado completamente, mi imagen se ve así: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rotado completamente, mi imagen se ve así:
``` | ||
|
||
## Actividad2 | ||
Esta es la respuesta de ejemplo para dibujar una línea desde el medio del tablero de color de la Actividad1 hasta su esquina inferior derecha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta es la respuesta de ejemplo para dibujar una línea desde el medio del tablero de color de la Actividad 1 hasta su esquina inferior derecha.
img.save('pixel-activity2.png') | ||
``` | ||
|
||
## Actividad3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a space between Actividad and the number?
…tally