Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 2
Ir a la página 1, 2  Siguiente
 
Imagestat Tiene Un Bug
Autor Mensaje
Responder citando   Descargar mensaje  
Mensaje Imagestat Tiene Un Bug 
 
Hola.

Estoy usando la clase ImageStat para averiguar el ancho y alto de las imágenes antes de cargarlas al pictureview pero resulta que no funciona.
Esta clase tiene las siguientes propiedades:
Depth, Height, Path, Type y Width.
Todas estas propiedades retornan los datos correctamente pero el Height no. en el ejemplo que hice con una imagen de 117x160 (HxW) retorna un w=160 y un h=4360.

Alguna sugerencia?

Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Sì,  tienes razón.
Usando ImageStat( ).Height con imagenes de tipo JPG, siempre devuelve el valor: 4360.

Comuniqué este problema en la Mailing List internacional.

saludos
 



 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Bueno mientras tanto hice esta funcion que permite recuperar datos de la imagen (y cualquier archivo con metadatos)

Public Function ExifTool(strPath As String) As String[]
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.

  Dim strExifRaw As String
  Dim stxExifRaw As New String[]
  Dim strExif As String
  Dim stxExif As New String[]
  Dim intR As Integer
  Dim intCursor As Integer
  Dim intLen As Integer

  'Verificacion de la existencia del archivo
  If Exist(strPath) = True Then
    If Stat(strPath).Type = gb.File Then
  ' Toma todos los tags del archivo
      Shell "exiftool -f -s -s '" & strPath & "' 2>&1" To strExifRaw
      stxExifRaw = Split(strExifRaw, "\n")
      For intR = 0 To stxExifRaw.Max
        If stxExifRaw[intR] <> "" Then
          intCursor = InStr(stxExifRaw[intR], ": ")
          intLen = String.Len(stxExifRaw[intR])
          strExif = String.Mid(stxExifRaw[intR], 1, intCursor - 1) & "|" & String.Mid(stxExifRaw[intR], intCursor + 2, intLen - intCursor - 1)
 ' Preparación de la matriz de datos
          stxExif.Add(strExif)
        Endif
      Next
    Endif
  Endif
  Return stxExif
End


Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
tincho escribió: [Ver mensaje]

      Shell "exiftool -f -s -s '" & strPath & "' 2>&1" To strExifRaw
    




Porque siempre usar Shell ?    


Son posibles muchas alternativas. Por ejemplo en solo Gambas:
http://www.gambas-it.org/wiki/index...sorgenti_Gambas
 



 
última edición por vuott el Domingo, 03 Julio 2016, 20:34; editado 2 veces 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
vuott escribió: [Ver mensaje]
Porque siempre usar Shell ?

Por ignorancia Vuott,   pero mira me intereso tu wiki, e hice una función con ese método.

Public Function ImageStatTemp(strPath As String) As String[]
  ' This program is free software; you can redistribute it and/or modify
  ' it under the terms of the GNU General Public License as published by
  ' the Free Software Foundation; either version 2 of the License, or
  ' (at your option) any later version.

  Dim stxExif As New String[]
  Dim objImage As Image

  'Verificacion de la existencia del archivo
  If Exist(strPath) = True Then
    If Stat(strPath).Type = gb.File Then
      objImage = Image.Load(strPath)
      stxExif.Add("ImageWidth|" & objImage.Width)
      stxExif.Add("ImageHeight|" & objImage.Height)

    Endif
  Endif
  Return stxExif

End


Gracias.
Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Buenas noches.

He probado con jpg y da error, pero si pruebo con png no da error.  

Public Sub Form_Open()

   Dim ruta As String
   Dim nomarchivo As String
  
   ruta = User.Home &/ "Imágenes/"
   For Each nomarchivo In Dir(ruta, "*.png").Sort()
     DatosDeImagen(ruta & nomarchivo)
   Next
  
End

Public Sub DatosDeImagen(nom As String)
  With ImageStat(nom)
    Print "Profundidad: " & .Depth    
    Print "Ruta: " & .Path
    Print "Tipo: " & .Type
    Print "Ancho: " & .Width  
    Print "Alto: " & .Height  
  End With
  Print
End
 


Citar:

.....
Profundidad: 24
Ruta: /home/jack/Imágenes/25MAYO.png
Tipo: image/png
Ancho: 584
Alto: 704


Saludos
 




===================
Gambas Básico
"No es un bug, es una característica no documentada"
 
Shell - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
tincho escribió: [Ver mensaje]

 objImage.Height


Sì, me olvidé    que existe la propiedad .Height de la Clase Image !
 



 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Vuott:

Citar:

Sì, me olvidé que existe la propiedad .Height de la Clase Image !


Pues eso parece, he cambiado algo el código, como ves solo se puede aplicar tres propiedades
básicas.  Las otras propiedades se podrán averiguar de otra forma. Pasándole una ruta con el nombre del archivo y
no directamente una imagen.

Public Sub DatosDeImagen(tmpimagen As Image)  

  With tmpimagen
    Print "Profundidad: " & .Depth        
    Print "Ancho: " & .Width  
    Print "Alto: " & .Height    
    Print
  End With
  
End
 


De todas manera, ImageStat tiene ese bug con la propiedad altura cuando es jpg.

Saludos
 




===================
Gambas Básico
"No es un bug, es una característica no documentada"
 
Shell - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Bueno, para los que actualizan su gambas via SVN: el bug ha sido corregido con rev.  7813
 



 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Imagestat Tiene Un Bug 
 
Citar:

Bueno, para los que actualizan su gambas via SVN: el bug ha sido corregido con rev.  7813


Entonces, por ahora solo para los que usan versión de desarrollo.
Por ahora la versión beta que es la que tengo en este pc:

3.8.4.90+bzr6092-28.47~ubuntu14.04.1

No se ha vuelto a actualizar desde el 31-5-16 según el histórico de Synaptic
de esta máquina.

Saludos
 




===================
Gambas Básico
"No es un bug, es una característica no documentada"
 
Shell - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Si Textbox Tiene 12 Caracteres Se Habilita... zero14 General 2 Martes, 17 May 2011, 02:49 Ver último mensaje
zero14
No hay nuevos mensajes En Gambas 3 Tiene Problema De Imprimir david Controles/Librerías/Componentes 2 Martes, 11 Octobre 2011, 20:43 Ver último mensaje
david
No hay nuevos mensajes TextBox No Tiene Evento Clic? v3ctor General 2 Domingo, 01 Junio 2014, 16:55 Ver último mensaje
v3ctor
No hay nuevos mensajes Alguien Tiene Un Tpv hecho en Linux? desoljor General 2 Jueves, 21 Abril 2016, 19:47 Ver último mensaje
jsbsan
 

Publicar nuevo tema  Responder al tema  Página 1 de 2
Ir a la página 1, 2  Siguiente

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron